How do Redirect HomePagevAfter Login Successfuliy
after successfully login, if I copy the URL and paste it into same browser tab then it should be redirect homepage page use asp .net mvc4. Here use this CodeHomeController.cs
public ActionResult DomainLogin(string returnUrl){}
public string Loginss(LoginModel model, string returnUrl){}
use Cookies for FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
RouteConfig.cs
public static void RegisterRoutes(RouteCollection routes)
{
HttpContext ctx = HttpContext.Current;
if (ctx.Session == null)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }
);
}
else
{
if (ctx.Session != null)
{
if (ctx.Session.IsNewSession)
{
string sessionCookie = ctx.Request.Headers["Cookie"];
//if ((sessionCookie != null) || (sessionCookie.IndexOf("ASP.NET_SessionId") >= 0))
if (sessionCookie != null)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Home_Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
}
}
}
Global.asax.cs
protected void Session_Start(object sender, EventArgs e)
{
RouteConfig.RegisterRoutes(RouteTable.Routes);
}