在RouteConfig.cs设置为url呼叫上的默认页面之后,未重定向到登录页面



i将ruteconfig.cs设置为

routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 
        routes.MapRoute(
          name: "Default",
          url: "{controller}/{action}/{id}",
          defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
        routes.MapRoute(
        name: "404-PageNotFound",
        url: "{*url}",
        defaults: new { controller = "Error", action = "PageNotFound" }
        );

但是,当我在网站上url时,它会导航到我的404页,因为我在我的url中不使用任何contoller名称和动作名称www.this.com不是www.this.com/home.index.it,当我将URL放入www.this.com时,我应该将我重新登录页面请任何帮助。

我从这里取了答案:

您必须在<system.web>中的web.config中添加:

<customErrors mode="On" defaultRedirect="~/Home/Index" />

您的意思是吗?

相关内容

最新更新