Server.Transfer is limited?
I'm working at ASP.NET Web Application project and I created a handler, that obviously implement an IHttpHandler Interface, for process and generate a binary file to force a download it.
After config the Web.Config file, the request for "*.abc" file extension will be now intercepted for this handler. But, there is a big problem here, because I'm using the Server.Transfer method, so I cannot send a handler instance for overload of this method or call the "virtual path" directly, like "Page.abc". You can confirm this information decompiling the Transfer method using the Reflector tool:
[ --- Supress --- ]
else if (!(handler is Page))
{
error = new HttpException(0x194, string.Empty);
}
[ --- Supress --- ]
if (error != null)
{
[ --- Supress --- ]
throw new HttpException(SR.GetString("Error_executing_child_request_for_handler",
new object[] { handler.GetType().ToString() }), error);
}
Independently of Transfer method overload that you use, the error message is the same: "Error executing child request for [handler | Page.abc].". So, the reason why I cannot use the Response.Redirect is that I need to send parameters through Context.Items collection for security intentions.
The temporary solution is to inherit the Page class instead implements IHttpHandler Interface in my handler, but I believe that "solution" isn't elegant.