2

I am using ASP.Net MVC to build a web Application. I am using popup to login a user.

When user is going to authenticate in Login ActionResult then a request goes to Dashboard as RedirectToAction("BloggerDashboard").

If the request to login is sent from Index page for example, then it also redirect to "BloggerDashboard".

I want to get current request address from where request has been sent to login and after successful login redirect to same page from where request was sent.

For example if request sent form Index view to login then after login it redirect to Index dynamically.

Is it possible?

2
  • that's is what you're looking for. Dec 23, 2015 at 9:16
  • Url.Action("Index", "Login", new { ReturnUrl = filterContext.RequestContext.HttpContext.Request.RawUrl }); Dec 23, 2015 at 10:34

2 Answers 2

2

Edited

simple code example like at below:

    public ActionResult Index()
    {

     return RedirectToAction("Login", new { url = Request.RawUrl.ToString()})
    }

    public ActionResult Login(string url)
    {

     return Redirect(url);
    }
0
0

If You are using a pop up why not return following from your action method.

return Redirect(Request.RawUrl);

Not the answer you're looking for? Browse other questions tagged or ask your own question.