I have this path that I need to handle:
http://mpdev.website.com/Account/ExternalLogOn?LogonTicket=c3792319c8711a0dd465bbd6f6b31ea913b42db7&PID=1137565&ReturnUrl=/Home/CompReq?EC=151120TXAM
The ExternalLogon action in the Account Controller automatically logs the user in based on a check between the LogonTicket and the PID. Then it is supposed to redirect to the ReturnUrl.
How would I fix the /Home/CompReq route to handle the EC parameter and how to modify the Action in the Home Controller?
I have only one route in my RouteConfig:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
This link works perfectly but I know I don't have any params on it.
http://mpdev.website.com/Account/ExternalLogOn?LogonTicket=c3792319c8711a0dd465bbd6f6b31ea913b42db7&PID=1137565&ReturnUrl=/Home/MyInfo
Home Controller Action definition is like this:
public ActionResult CompReq(string eventcode)
ExternalLogon definition:
ExternalLogOn(string LogonTicket, int? PID, string User, string EC, String State, string ReturnUrl)
ReturnUrl value should be url encoded:
http://mpdev.website.com/Account/ExternalLogOn?LogonTicket=c3792319c8711a0dd465bbd6f6b31ea913b42db7&PID=1137565&ReturnUrl=%2FHome%2FCompReq%3FEC%3D151120TXAM
CompReq action should have same function parameter name as query parameter name:
public ActionResult CompReq(string EC)
ExternalLogon action should have proper parameters:
ExternalLogOn(string LogonTicket, int? PID, string ReturnUrl)
In ExternalLogOn you do a redirect to ReturnUrl param:
return Redirect(ReturnUrl);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.