2011-04-27 78 views
0

我有一个ASP.NET MVC 1 Web应用程序使用ASP.NET成员资格提供程序。在我的本地框中,当我向表单提交数据时,重定向将它带到适当的位置(使用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> 
+0

我发现了比我在这里提到的更深的问题。这个问题现在已经过时了。这里是我基于我在事件日志中发现的新问题:http://stackoverflow.com/questions/5810982/mvc-1-and-iis-7-error-code-4011 – 2011-04-27 21:44:49

回答

-1

如果您使用的是MySQL等的用户数据存储,这样的问题可能发生,因为不同的MySQL连接器版本在我们的本地PC和服务器上

+0

情况并非如此。我正在使用本地托管的MS SQL Server。 – 2011-04-27 13:53:26

+0

为什么-1?我的项目中有这样的问题。当我测试项目localy - 每件事情都很好,但是当发布到服务器 - 验证不起作用。解决方案是将MySQL连接器更改为另一个版本。 – 2011-04-27 16:14:05

+0

对不起,发现了这个错误。我以为你使用MySQL – 2011-04-27 16:22:40

0

默认情况下,MVC 1使用Forms auth。您可能需要检查自己的表单身份验证设置,以确保您没有被重定向为安全性的一部分。

+0

我已经发布我的web.config片断,看看是否有什么让人大跌眼镜? – 2011-04-27 14:14:19

+0

看看我找到了什么! http://forums.iis.net/p/1176536/1975388.aspx – 2011-04-27 14:38:53