How to set the ReturnUrl for the Login link in MVC 3 app?
- by user762196
using System;
using Microsoft.Practices.Unity;
namespace <MyNameSpace>
{
public class UrlFactory
{
public static UrlFactory Current
{
get { return HttpApplicationUnityContext.Current.Resolve<UrlFactory>(); }
}
public string GetLoginUrl()
{
return String.Format("{0}/login?ReturnUrl={1}", MyConfig.BaseHttpUrl, <GET_PAGE_URL>);
}
}
The user can be on any page on the site and click the Login link.
But the ReturnUrl must always point to the exact page where he clicked it.
I must take the user back to the page he clicked the login link.
In my code above, how do I get the page url in
<GET_PAGE_URL>?
Thanks