I had done many solutions for Last Visited page after Login but I am unable to found any solutions. Please help me with this
ViewBag.returnUrl = Request.Headers["Referer"].ToString();
I had done this & call Viewbag.returnUrl in cshtml page of Login but not working
The redirect should happen in the Controller after the credentials are validated. Instead of returning the login page with the viewbag information, like mentioned here:
redirect to url in ASP.net core
If you're doing this with JS, or you need to land on this page first, for whatever reason, then you can just redirect using javascript:
window.location.replace("myUrl");
You can use Request.QueryString[]
. Set from master page and get data from login page. If login is confirmed redirect this URL.
Try This Method
ViewBag.returnUrl = Request.QueryString["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.