I have a class that is creating and downloading a PDF file. If I call this class from my c# codebehind, it works like a champ. If, however, I try to call it from a Web Service, it simply does nothing. No errors, no file creation, it just runs to the end of the function and returns, and that's that. I traced through the code to see what's different about the two calls to the same function, and the only difference I've found is that the HTTPContext handler is different. The successful codebehind call uses the handler ASP.behavior_referrals_aspx and the unsuccessful Web Service call uses the handler System.Web.Script.Services.ScriptHandlerFactory.HandlerWrapper.
I've been reading on handlers all afternoon until my head is spinning. I do now understand that handlers will process code in different ways, so I'm thinking this is where my issue is. My question (finally!!) is, can I just remap the handler that is being used from the service method, to use the ASP.behavior_referrals_aspx handler instead? I've been trying every variation I can of HttpContext.Current.RemapHandler(ASP.behavior_referrals_aspx); -- using casting, etc., but everything pretty much comes back and says The name <> does not exist in the current context. Is there a simple solution that I just don't know? Or a difficult one, even?