C# MVC3在哪里重定向未经授权的用户?

C# MVC3在哪里重定向未经授权的用户?,c#,asp.net-mvc-3,redirect,authorization,forms-authentication,C#,Asp.net Mvc 3,Redirect,Authorization,Forms Authentication,因此,我有一个ASP.NET MVC3应用程序,其中包含以下web.config <?xml version="1.0"?> <configuration> .... <system.web> .... <authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" defaultUrl="~" slidingExpira

因此,我有一个ASP.NET MVC3应用程序,其中包含以下web.config

<?xml version="1.0"?>
<configuration>
  ....
  <system.web>
  ....
    <authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" defaultUrl="~" 
            slidingExpiration="true" timeout="10080" />
    </authentication>
如果我没有登录,并且我尝试点击http//localhost/myAppPath/MetaStyle,我会被重定向到上面定义的登录页面,对吗

那么为什么我会被重定向到
http://localhost/myAppPath/Account/Login?ReturnUrl=%2fmyAppPath%2fMetaStyle
?(注意,url具有登录,而不是登录

Login
来自哪里?我在我的项目中没有看到它。

请参见。根据它,你应该使用以下应用程序设置

<add key="autoFormsAuthentication" value="false" />


您在该URL上看到了有效页面吗?Spender,看看John Galloway的这篇文章是否有帮助:我们正在搜索登录幻影:)我猜是父/子目录中有重叠的web.config文件。。。帐户/登录名应该在某处定义…@Colombo(好名字,顺便说一下!)该url中没有任何内容。我会在解决方案范围内搜索文本“login”以查找罪犯。:-)
<add key="autoFormsAuthentication" value="false" />