this page is redirected to login page
http://www.nextdhoom.com/Jobs/details/3253
http://www.nextdhoom.com/home/Login?ReturnUrl=%2fJobs%2fdetails%2f3253
now i want access controler name and method name and id details
like jobs
details and id which is 3253
how do i do that
got it its regex
Regex regex = new Regex("^/(?<Controller>[^/]*)(/(?<Action>[^/]*)(/(?<id>[^?]*)(/?(?<QueryString>.*))?)?)?$");
Match match = regex.Match(returnUrl);
var a= match.Groups["Controller"].Value;
var b=match.Groups["Action"].Value;
var id = Convert.ToInt32(match.Groups["id"].Value);
var d=match.Groups["QueryString"].Value;
HI,
Good work, i had problem once, fixed more traditional way like string functionality,
Regex regex = new Regex("^/(?<Controller>[^/]*)(/(?<Action>[^/]*)(/(?<id>[^?]*)(\?(?<QueryString>.*))?)?)?$");
Match match = regex.Match(returnUrl);
var fromController = match.Groups["Controller"].Value; // get from controller name.
var fromAction = match.Groups["Action"].Value; // get action name.
var id = Convert.ToInt32(match.Groups["id"].Value); // get first value of query string
var d = match.Groups["QueryString"].Value;// get next query string.
While use’s entered specific url with respective id(query string), then first go and check if user has an authorize, build model data( querystring value : pass and get specific model data’s), and return into requested page.
Thanks,
Jai.