2014-01-15 49 views
0

我使用ASP.NET MVC 4創建了一個Web應用程序,並將其上載到商用Web服務器上。我的問題是當我點擊指向~/Account/LogOn的動作鏈接時,彈出窗口出現「身份驗證」。如何禁用「需要驗證」彈出?

這是我的問題的開始,因爲我不知道我更改了哪些設置,或者是否存在無法設置的設置?

我在使用ASP.NET MVC 3之前創建了2個Web應用程序,並將其上載到同一個商業Web服務器上,並且運行完美。沒有什麼結果。

順便說一句,他們給我的服務器的訪問不是遠程桌面連接,它的Parallels。

vipul.surana由於我不到10分,我無法發佈圖片。所以,如果你可以,我會給你的網站地址。網站地址是www.clktb.com,然後按右上角的登錄按鈕。這裏

nwdev按要求就是我的web.config代碼我沒從原來的webconfig

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </configSections> 
    <appSettings> 
    <add key="webpages:Version" value="2.0.0.0" /> 
    <add key="webpages:Enabled" value="false" /> 
    <add key="PreserveLoginUrl" value="true" /> 
    <add key="ClientValidationEnabled" value="true" /> 
    <add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
    </appSettings> 
    <system.web> 

    <compilation debug="true" targetFramework="4.5"> 
     <assemblies> 
     <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     </assemblies> 
    </compilation> 
    <httpRuntime targetFramework="4.5" /> 
    <authentication mode="Forms"> 
     <forms loginUrl="~/Account/Login" timeout="2880" /> 
    </authentication> 
    <pages> 
     <namespaces> 
     <add namespace="System.Web.Helpers" /> 
     <add namespace="System.Web.Mvc" /> 
     <add namespace="System.Web.Mvc.Ajax" /> 
     <add namespace="System.Web.Mvc.Html" /> 
     <add namespace="System.Web.Optimization" /> 
     <add namespace="System.Web.Routing" /> 
     <add namespace="System.Web.WebPages" /> 
     </namespaces> 
    </pages> 
    </system.web> 
    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <handlers> 
     <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /> 
     <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /> 
     <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> 
     <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> 
     <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> 
     <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 
    </handlers> 
    </system.webServer> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" /> 
     <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" /> 
     <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> 
    </entityFramework> 
</configuration> 
+0

你使用什麼認證模式爲你的應用程序?它必須設置爲Windows身份驗證。此外,允許在IIS中進行匿名身份驗證。 –

+0

我正在使用Forms身份驗證。我會嘗試您的建議並使用Windows身份驗證。我真的很喜歡在IIS中設置允許匿名身份驗證,但由於我們的網絡託管只是一個負擔得起的,他們只讓我們使用平行,有反正我可以在我的代碼中添加它嗎? –

+0

發佈web.config代碼 – mezmi

回答

1

這這裏是我的帳戶/ Logon的移除代碼。

基於Damien Joe先生的話我引用「如果以後,那麼當前的網站項目肯定存在問題。」我雙重檢查的代碼在Logon的意見是,由於它是由ASP.NET MVC 4預製,我發現了一段代碼,是不是在MVC 3登錄

<%--<p><%: Html.ActionLink("Register", "Register") %> if you don't have an account. </p> 
    <hr /> 
    <section class="social" id="socialLoginForm"> 
     <h2>Use another service to log in.</h2> 
     <%: Html.Action("ExternalLoginsList", new { ReturnUrl = ViewBag.ReturnUrl }) %> 
    </section>--%> 

當我刪除這段代碼從我查看一切正常。如在完美中。這段代碼在這裏丟失了一天。希望未來的人們會看到這一點,並知道該怎麼做。

+0

很高興你知道了,並得到了一切工作! –

+0

感謝您的輸入達米安喬真的幫我指出了錯誤 –

+0

你受歡迎。如果你認爲我的帖子很有幫助,你可以點擊左邊的箭頭來上傳它。謝謝。 –

0

您的身份驗證模式設置爲Forms改變任何東西,除了去除連接字符串,並刪除了一些意見。除非必要,否則不要將其更改爲Windows (Windows僅用於基於LAN的環境,其中用戶由 Active Directory維護)。

我會檢查您的網站文件夾的目錄權限。轉到您的網站文件夾&右鍵單擊屬性 - >安全&檢查是否將已驗證的用戶添加到用戶組。

另外,你使用的是web服務?

編輯 這很可能是您的網站文件夾的權限問題。 檢查此鏈接的IIS http://support.microsoft.com/?id=258063 更多信息,也該線程ServerFault

+0

我沒有使用webservices。我檢查了所有經過身份驗證的用戶都已添加到用戶組中 - 並且他們都已添加。 –

+0

@RodrigoBusa還檢查該文件夾中包含的文件的類似權限。 –

+0

@RodrigoBusa更新了我的答案。 –