This is a migrated thread and some comments may be shown as answers.

Response.Redirect not working

3 Answers 669 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 15 May 2008, 01:25 AM
My ASP.NET application uses RADScriptManager and multiple RADAJAXPanels.

Response.Redirect's called in code behind executed via callbacks originating inside the RADAjaxPanels do not work and the following Javascript error is generated on the source page.

Also, probably related to this, the customerrors page does not get rendered in when runtime exceptions occur in code-behind. I assume it's due to the same problem that redirects are not working.

Thanks

Javascript error:

Line:

605

Char: 13

Error:Sys.WebForms.PageRequestManagerServerErrorException: An

unknown error occurred while processing the request on the server. The

status code returned from the server was: 0

Code: 0

3 Answers, 1 is accepted

Sort by
0
Andy
Top achievements
Rank 1
answered on 15 May 2008, 01:55 AM
The errors.aspx page does get called (debugger stopped on breakpoint on page load) but it looks like the html is streamed back to the calling page but is intercepted by the AJAX framework  and 

Sys.WebForms.PageRequestManagerParserErrorException throws an exception trying to parse the resulting html page.

0
Andy
Top achievements
Rank 1
answered on 15 May 2008, 02:30 PM
Follow-up:   When I explicitly force a httpcontext.current.reponse.Redirect(...) in my code-behind event handler called from within the RADAjaxPanel the target page is being called but the rendered page is coming back to the browser and the AJAX framework is throwing a runtime exception.

I added my own AJAX event handler in my source page containing the RADAjaxPanels and the _xmlHttpRequest.ResonseText contains the HTML rendered from the aspx page targeted by the resonse.redirect call.

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args)

    if (args.get_error() != undefined) 
    { 
        var errorMessage = args.get_error().message; 
        args.set_errorHandled(true); 
        alert(args._response._xmlHttpRequest.responseText);
    }
}
0
Maria Ilieva
Telerik team
answered on 16 May 2008, 05:18 AM
Hello A,

This is a known problem of the ASP.NET AJAX framework on which our ajax controls are based on. More info on the problem and solution are available here:

http://www.andornot.com/about/developerblog/2007/07/aspnet-ajax-and-syswebformspagerequestm.aspx
 
Kind regards,
Maria Ilieva
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Andy
Top achievements
Rank 1
Answers by
Andy
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or