2013-10-17 372 views
2

我使用Microsoft.AspNet.Membership.OpenAuth創建新的asp.net webform .net 4.0並配置AuthConfig。 CS:遠程服務器返回錯誤:(400)錯誤的請求Microsoft.AspNet.Membership.OpenAuth

OpenAuth.AuthenticationClients.AddFacebook(
       appId: "my appId", 
       appSecret: "my appSecret"); 

在Facebook的應用程序配置: 網站與Facebook登錄:http://www.tindep.com

但是,當我用Facebook登錄它的錯誤:

Server Error in '/' Application. 
The remote server returned an error: (400) Bad Request. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.WebException: The remote server returned an error: (400) Bad Request. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[WebException: The remote server returned an error: (400) Bad Request.] 
    System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +283 
    System.Net.WebClient.DownloadString(Uri address) +100 
    DotNetOpenAuth.AspNet.Clients.FacebookClient.QueryAccessToken(Uri returnUrl, String authorizationCode) +235 
    DotNetOpenAuth.AspNet.Clients.OAuth2Client.VerifyAuthentication(HttpContextBase context, Uri returnPageUrl) +142 
    DotNetOpenAuth.AspNet.OpenAuthSecurityManager.VerifyAuthentication(String returnUrl) +239 
    Microsoft.AspNet.Membership.OpenAuth.OpenAuthManager.VerifyAuthentication(HttpContextBase context, String returnUrl) +116 
    Microsoft.AspNet.Membership.OpenAuth.OpenAuth.VerifyAuthentication(String returnUrl) +82 
    EVNSoft.Website.Account.RegisterExternalLogin.ProcessProviderResult() +205 
    EVNSoft.Website.Account.RegisterExternalLogin.Page_Load() +24 
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +9808229 
    System.Web.UI.Control.OnLoad(EventArgs e) +92 
    System.Web.UI.Control.LoadRecursive() +54 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055 

雖然Google,Twitter,msdn登錄成功(查看tindep.com/Account/Login.aspx) 這只是在託管(tindep.com/Account/Login.aspx)時出錯。 localhost:57846/Account/Login.aspx登錄Facebook成功。

請幫助我找到原因。

非常感謝!

+0

也在尋找這個解決方案。 – shannon

回答

1

有開放的與此相關的一個缺陷: https://github.com/DotNetOpenAuth/DotNetOpenAuth/issues/203

但庫顯然不再維護: https://github.com/DotNetOpenAuth/DotNetOpenAuth/issues/317#issuecomment-29580565

...雖然它在許多微軟文檔仍引用。調查與另一個缺陷有關的問題。

另請參閱:facebook login using oauth fails on live server

+1

對於一個沒有意識到的外部觀察者來說,微軟在放棄舊的開源項目的同時,在微軟的一個新產品中出現了同樣的缺陷,並且微軟似乎很懷疑微軟將這個缺陷直接集成到了一個專有的閉環系統中,源營利性產品。 – shannon

相關問題