Friday, March 7, 2008

Using Response.Redirect in ASP.NET Ajax Update Panel

Error: 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. Solution 1
private void RedirectTo(string url)
{
string redirectURL = Page.ResolveClientUrl(url)
string script = "window.location = '" + redirectURL + "';";
ScriptManager.RegisterStartupScript(this, typeof(Page), "RedirectTo", script, true);
}
Solution2
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
httpModules> Solution3 Add this in web.config file enableEventValidation="false"

4 comments :

  1. only solution 1 is working but 2nd and 3rd doesnt make any difference
    wel, thanks for the 1st one but still i will prefer 2nd and 3rd if they work somehow

    does anyone help in this
    i am working on 3.5

    ReplyDelete
  2. I feel the solution is dependent from scenario to scenario.

    For me solution 1 and 3 didn't work but solution 2 worked very well.


    Thanks a lot for your efforts on this issue.

    ReplyDelete
  3. I just tried 2nd one and it worked for me..
    Really thanks a lot..

    ReplyDelete
  4. #2 worked great, thanks!

    ReplyDelete