为什么我的应用程序打开空白页面并且在路由页面后不转到任何重定向 link?

Why my app opens empty page and doesn't go to any redirect link after route page?

为什么我的应用打开空白页面并且在路由页面后不转到任何重定向 link? 我从事 C#、MVC、Visual studio 2010

这是我的登录操作:

[HttpGet]
    [AllowAnonymous]
    public ActionResult Login()
    {
        return View();
    }

    [HttpPost]
    [AllowAnonymous]
    public ActionResult Login(string name, string psw)
    {
        if ((Membership.ValidateUser(name, psw)) == true)
        {
            FormsAuthentication.SetAuthCookie(name, false);
            if ((Roles.IsUserInRole(name, "Admin")) == true)
            {
                return this.RedirectToAction("AboutDetails_Admin", "mytask");

            }
            else if ((Roles.IsUserInRole(name, "People")) == true)
            {
                return this.RedirectToAction("TMembersDetails_Admin", "mytask");
            }
            else return View();
        }
        else return this.RedirectToAction("Register", "Default");
    }

这是登录视图:

 @{
  ViewBag.Title = "Login";
  Layout = "~/Views/_LayoutPage1.cshtml";
 }

 <h2>Login</h2>

 <form action="/Default/Login" method="post">
  <label>Full Name:</label><input type="text" name="name" /><br />

 <label>Password:</label><input type="text" name="psw" /><br />

 <input type="submit" />


 </form>

这是我的 web.config :

enter code here

<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor"      type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup,   System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral,   PublicKeyToken=31BF3856AD364E35">
  <section name="host"   type="System.Web.WebPages.Razor.Configuration.HostSection,   System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
  <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
   </sectionGroup>
   </configSections>

 <system.web.webPages.razor>
 <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc,   Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  <pages pageBaseType="System.Web.Mvc.WebViewPage">
   <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="ttt" />
  </namespaces>
</pages>
</system.web.webPages.razor>

<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>

<system.webServer>
<handlers>
  <remove name="BlockViewHandler"/>
  <add name="BlockViewHandler" path="*" verb="*"   preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
  </handlers>
  </system.webServer>

  <system.web>
  <compilation>
  <assemblies>
    <add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral,   PublicKeyToken=31BF3856AD364E35" />
   </assemblies>
  </compilation>
  </system.web>
  </configuration>

这是我的路线:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace ttt
{
public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        //routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "",
            defaults: new { controller = "Default", action = "Index", 
                 id = UrlParameter.Optional }
        );
    }
   }
  }

我该怎么做才能让我的索引页面重定向到登录页面而不是用 http://localhost:1889/Default/Login

打开空白页面

我发现了错误, 在 visual studio 2015 年的第一个项目中,当我选择新项目时,它使项目身份验证:默认情况下为个人,因此当项目 运行 时,结果为空页。 当我将身份验证(第一个)更改为无身份验证时,它现在可以工作了。