0

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?

Jimmy Genslinger
  • 557
  • 3
  • 21
  • "creating and downloading PDF file"? I can see "creating and uploading" or "downloading", but I don't get how "creating and downloading" should behave. Some code definitely would help. – Alexei Levenkov Sep 02 '15 at 20:57
  • Sorry, here is a link to my initial thread with lots of code samples: http://stackoverflow.com/questions/32319367/how-does-httpcontext-current-response-binarywrite-work/32319607#32319607. I started a new thread because this feels like a new question that has originated off the original post...but I'm planning on updating the original post as well if I get things working. Basically I have a user control that lets folk pick as many schools as they want to generate a PDF for, cycles through and builds out the html, then downloads the PDF. – Jimmy Genslinger Sep 02 '15 at 21:04

0 Answers0