我简单地运行应用程序,并期望看到登录。但我看到的是这一页:

我已经在web.config文件中定义了路由和表单身份验证元素,如下所示:路由:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}主计长:
[Authorize]
public class HomeController : Controller
{
public ActionResult Index()
{
trywebconfig:
<authentication mode="Forms">
<forms loginUrl="~/Auth/Login" timeout="2880"/>
</authentication>我在这里可能缺少了什么?
发布于 2016-07-18 20:04:59
请检查下面的链接,它可能会帮助您http://dotnetdevdude.com/Blog/2011/11/21/ASPNETMVCRedirectToCustomPageWhenUserIsNotAuthorized.aspx
https://stackoverflow.com/questions/38444992
复制相似问题