Response.Redirect problem
-
Hi, I'm using ASP.net MVC, In a certain controller ("Users") I have a "LoginNeeded()" method, this one redirects you if you are not logged in: if (CurrentUser == null) { HttpContext.Response.Redirect("/Users/Login/", true); } The problem: If a method from the Users controller calls this method.. everything works fine. If a method from another controller calls this method.. It doesnt find the action i'm redirecting (it tries to search in "Shared/Users/Login" and "ThisOtherController/Users/Login" Any help?!
-
Hi, I'm using ASP.net MVC, In a certain controller ("Users") I have a "LoginNeeded()" method, this one redirects you if you are not logged in: if (CurrentUser == null) { HttpContext.Response.Redirect("/Users/Login/", true); } The problem: If a method from the Users controller calls this method.. everything works fine. If a method from another controller calls this method.. It doesnt find the action i'm redirecting (it tries to search in "Shared/Users/Login" and "ThisOtherController/Users/Login" Any help?!
Try instead
HttpContext.Response.Redirect("~/Users/Login/", true);
Adam Maras | Software Developer Microsoft Certified Professional Developer
-
Try instead
HttpContext.Response.Redirect("~/Users/Login/", true);
Adam Maras | Software Developer Microsoft Certified Professional Developer
Doesnt work either...