2011-04-27 80 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