2013-10-17 201 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

相关问题