DotNetOpenAuth with Ajax on Visual Studio 2010 .NET 4 problem
I have been using DotNetOpenAuth's "OpenIdTextBox" control on our login page. We used VS 2008 + .NET 3.5 + Ajax UpdatePanel without any issues.
Today we tried to upgrade the whole project to VS 2010 + .NET 4.0, the Ajax UpdatePanel gives me a javascript error when it redirects to the provider (such as Google) to sign in.
"Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled"
Is there any settings I can make this work? The weird thing is... it worked on VS 2008 + .NET 3开发者_如何学运维.5. Thanks....
I don't know how the UpdatePanel works, but the OpenIdTextBox control needs the ability to redirect the entire browser document to another URL, which perhaps UpdatePanel isn't allowing because it only expects a content response to update a small area of the web page. So perhaps OpenIdTextBox is fundamentally incompatible with UpdatePanel -- just a guess.
I wonder if you can elect somehow at the server side while processing the page to disable the UpdatePanel's optimizations, if for example the OpenIdTextBox_LoggingIn event was fired.
Otherwise of course you can move the text box outside the UpdatePanel, but perhaps that can't be done while maintaining the appearance of yoru web page.
I could tell you how to override the way OpenIdTextBox redirects the web page, but anything you might do that is equivalent would likely run into the same problem.
Thanks Andrew! It worked (I am answering to my own post). Basically, I solved this Ajax problem by using "Response.RedirectLocation".
According to some articles, this is an Ajax friendly call for some reasons, I don't exactly know what's the difference because I guess "e.Request.RedirectingResponse" is doing the same thing. Anyways, I then extacted the location from "RedirecingResponse" header. I tested with 8 providers, it seems working!
e.Cancel = true;
OutgoingWebResponse webResponse = e.Request.RedirectingResponse;
string location = webResponse.Headers["Location"];
Response.RedirectLocation = location;
精彩评论