表单提交返回登录屏幕

时间:2011-04-27 02:17:13

标签: asp.net asp.net-mvc web-config asp.net-membership

我有一个使用ASP.NET成员资格提供程序的ASP.NET MVC 1 Web应用程序。在我的本地方框中,当我向表单提交数据时,重定向将其带到正确的位置(使用Controller.RedirectToRoute)。在它应该存在的服务器上,表单提交将我带回登录页面。数据发布正确,但我只是错误地重定向。

我记得几年前处理过这个问题(在非MVC应用程序中),这是由于Web.Config相对于成员资格提供者的问题。

我无法想象我是唯一一个遇到这个问题的人。我应该在web.config中寻找什么可能与此相关?

提前致谢。


修改

以下是我的身份验证和web.config的成员资格部分:

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<membership>
  <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="IPS" />
  </providers>
</membership>
<profile>
  <providers>
    <clear />
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="IPS" />
  </providers>
</profile>
<roleManager enabled="true">
  <providers>
    <clear />
    <add connectionStringName="ApplicationServices" applicationName="IPS" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <add applicationName="IPS" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </providers>
</roleManager>

2 个答案:

答案 0 :(得分:0)

MVC 1默认使用Forms auth。您可能需要检查表单身份验证设置,以确保不会将您重定向为安全性的一部分。

答案 1 :(得分:-1)

如果您使用MySQL就像用户数据存储一样,由于我们本地PC和服务器上的MySQL Connector版本不同,可能会出现此类问题