DotNetOpenAuth未能Live服务器上工作 [英] DotNetOpenAuth Failing to work on Live Server

查看:249
本文介绍了DotNetOpenAuth未能Live服务器上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作一个示例应用程序集成的OpenID到ASP.NET Web窗体。在我的机器上本地托管它工作正常。然而,当我上传应用程序中的服务器,就开始给登录失败。

您可以在这里品尝一个样本: http://samples.bhaidar.net/openidsso

任何想法?

下面是源$ C ​​$ C失败处理的OpenID响应:

 私人无效HandleOpenIdProviderResponse()
    {
        //定义OpenIdRelyingParty类的新实例
        使用(VAR的OpenID =新OpenIdRelyingParty())
        {
            //从OpenID提供商验证响应创建IAuthenticationResponse实例时使用
            //中检索从OP响应
            变种响应= openid.GetResponse();            //没有认证请求发送
            如果(响应== NULL)回报;            开关(response.Status)
            {
                //如果用户通过身份验证
                案例AuthenticationStatus.Authenticated:
                    //这是在那里你会寻找任何包含扩展OpenID的反应
                    //在认证断言。
                    VAR fetchResponse = response.GetExtension< FetchResponse>();                    //存放所查询字段
                    会话[FetchResponse] = fetchResponse;                    //使用FormsAuthentication告诉ASP.NET该用户现在登录,
                    //与OpenID的身份标识为他们的用户名。
                    FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier,FALSE);
                    打破;
                //用户已经取消了OpenID的舞蹈
                案例AuthenticationStatus.Canceled:
                    this.loginCanceledLabel.Visible = TRUE;
                    打破;
                //验证失败
                案例AuthenticationStatus.Failed:
                    this.loginFailedLabel.Visible = TRUE;
                    打破;
            }        }


解决方案

打开您的在线服务器上登录并检查它们是否附加诊断。这是最有可能您的服务器上安装了防火墙或权限问题prevents出站HTTP请求。​​

您也可能会发现看 IAuthenticationResponse.Exception 属性时为线索的身份验证失败。

I worked on a sample application integrating OpenID into ASP.NET Web Forms. It works fine when hosted locally on my machine. However, when I uploaded the application to a live server, it started giving "Login Failed".

You can try a sample here: http://samples.bhaidar.net/openidsso

Any ideas?

Here is the source code that fails to process the OpenID response:

   private void HandleOpenIdProviderResponse()
    {
        // Define a new instance of OpenIdRelyingParty class
        using (var openid = new OpenIdRelyingParty())
        {
            // Get authentication response from OpenId Provider Create IAuthenticationResponse instance to be used
            // to retreive the response from OP
            var response = openid.GetResponse();

            // No authentication request was sent
            if (response == null) return;

            switch (response.Status)
            {
                // If user was authenticated
                case AuthenticationStatus.Authenticated:
                    // This is where you would look for any OpenID extension responses included
                    // in the authentication assertion.
                    var fetchResponse = response.GetExtension<FetchResponse>();

                    // Store the "Queried Fields"
                    Session["FetchResponse"] = fetchResponse;

                    // Use FormsAuthentication to tell ASP.NET that the user is now logged in,
                    // with the OpenID Claimed Identifier as their username.
                    FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, false);
                    break;
                // User has cancelled the OpenID Dance
                case AuthenticationStatus.Canceled:
                    this.loginCanceledLabel.Visible = true;
                    break;
                // Authentication failed
                case AuthenticationStatus.Failed:
                    this.loginFailedLabel.Visible = true;
                    break;
            }

        }

解决方案

Turn on logging on your live server and inspect them for additional diagnostics. It's most likely a firewall or permissions problem on your server that prevents outbound HTTP requests.

You may also find it useful to look at the IAuthenticationResponse.Exception property when an authentication fails for clues.

这篇关于DotNetOpenAuth未能Live服务器上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆