views:

836

answers:

3

Hi,

I have a HttpModule in C# 2.0 which handles exceptions thrown. Whenever the exception is thrown, an error page (aspx) with some querystring will be called. It is done through Server.Transfer().

But when the control tries to execute Server.Transfer(), an exception "Error executing child request for [pagename].aspx." is thrown. Where as Request.Redirect() works fine.

I tried setting EnableViewStateMac="false" in Page directive of the page to which request is transfered. Still problem persists.

Here is the code I tried:

string errorPage = "errorpage.aspx?id=" + someErrorId
HttpContext.Current.Server.Transfer(errorPage,true);

Any idea how this can be resolved?

A: 

I found an alternative to Server.Transfer()

I used

 HttpContext.Current.RewritePath("somefile.aspx");

This solved the issue.

Amit
How did you use it? The exception *Error executing child request* disappeared, but I get an empty page.
SergeanT
A: 

It isn't a bug, it is by design. See http://support.microsoft.com/kb/320439

Jamie
Yes I had seen that. But I had a requirement not change the URL on the address bar.
Amit
A: 

i'm getting the same error using the server transfer but your work around isn't working for me because the following sample does't pass the parameter to controller action HttpContext.Current.RewritePath("somefile.aspx?id=kjwe1298-jkjds-2121");

do you know why?

Marco