English 中文(简体)
nullpointer for yahoo openid request, but not google (dotnetopenid)
原标题:

i m programmatically doing an openid handshake with yahoo and google. google is fine, but yahoo throws a null pointer:

stack trace:

   System.NullReferenceException: Object reference not set to an instance of an object.
   at DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy.PolicyResponse.DotNetOpenAuth.Messaging.IMessageWithEvents.OnReceiving() in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthOpenIdExtensionsProviderAuthenticationPolicyPolicyResponse.cs:line 189
   at DotNetOpenAuth.OpenId.ChannelElements.ExtensionsBindingElement.<GetExtensions>d__a.MoveNext() in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthOpenIdChannelElementsExtensionsBindingElement.cs:line 209
   at DotNetOpenAuth.OpenId.ChannelElements.ExtensionsBindingElement.ProcessIncomingMessage(IProtocolMessage message) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthOpenIdChannelElementsExtensionsBindingElement.cs:line 151
   at DotNetOpenAuth.Messaging.Channel.ProcessIncomingMessage(IProtocolMessage message) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthMessagingChannel.cs:line 906
   at DotNetOpenAuth.OpenId.ChannelElements.OpenIdChannel.ProcessIncomingMessage(IProtocolMessage message) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthOpenIdChannelElementsOpenIdChannel.cs:line 171
   at DotNetOpenAuth.Messaging.Channel.ReadFromRequest(HttpRequestInfo httpRequest) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthMessagingChannel.cs:line 377
   at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.GetResponse(HttpRequestInfo httpRequestInfo) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthOpenIdRelyingPartyOpenIdRelyingParty.cs:line 489
   at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.GetResponse() in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthOpenIdRelyingPartyOpenIdRelyingParty.cs:line 478
   at Friendsell.UI.Controllers.Auth.OpenIdReturnController.DoProcessRequest(IExecutionContext context) in C:DevelopmentFriendsellFriendsell.UIControllersAuthOpenIdController.cs:line 41
   at Bistro.Controllers.AbstractController.ProcessRequest(HttpContextBase context, IContext requestContext) in C:DevelopmentBistroBistro.CoreControllersAbstractController.cs:line 41
   at Bistro.Controllers.MethodDispatcher.InvokeMethodDirect(HttpContextBase context, String requestPoint, IContext requestContext) in C:DevelopmentBistroBistro.CoreControllersMethodDispatcher.cs:line 221
   at Bistro.Controllers.MethodDispatcher.InvokeMethod(HttpContextBase context, String requestPoint, IContext requestContext) in C:DevelopmentBistroBistro.CoreControllersMethodDispatcher.cs:line 119

invoking code:

        var openid = new OpenIdRelyingParty();
        IAuthenticationRequest request = openid.CreateRequest(
            Identifier.Parse(
                GetEndpoint()),
                new Realm(realm),
                new Uri(returnUri));

        // Require some additional data
        request.AddExtension(new ClaimsRequest
        {
            Email = DemandLevel.Require,
            FullName = DemandLevel.Request,
            PostalCode = DemandLevel.Request
        });

        try
        {
            request.RedirectToProvider();
        } catch (ThreadAbortException)
        {
        }

receiving code (and the source of the exception)

        var openId = new OpenIdRelyingParty();
        var response = openId.GetResponse(); <-- exception happens here

what gives? the weird thing is that the yahoo piece was working recently, and i haven t changed the library version...

最佳回答
问题回答

I think you want to look at your CreateRequest. Also you can t catch ThreadAbortException, it self-propagates. Therefore you need to catch it twice.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签