Last post Sep 14, 2014 12:11 AM by IranianCuriousBoy
Sep 13, 2014 06:55 AM|IranianCuriousBoy|LINK
I have an aspx page with a button and when user clicks the button, it do two things. 1- It sends a file with transfering Page HTTPContext to a HTTPHandler that sends a download to browser. 2-It shows a message to the user that the file has been sent. the
problem is that the second is not run. I guess the HTTPHandler terminates page life cycle. Is there any way to do both?
Sep 13, 2014 02:49 PM|hakenr|LINK
you have to transfer the browser to file download on client side as it is not possible to send a file and modified page content (message) to the client in one HTTP response.
So instead of transferring the HttpContext to HttpHandler on server side, just send regular HTML response with your message and add something what instructs the browser to ask for the file you want the user to download, ie. <iframe> or
<iframe width="1" height="1" frameborder="0" src="[File location - your HttpHandler URL]"></iframe>
Sep 14, 2014 12:11 AM|IranianCuriousBoy|LINK
Thanks for the simple solution. Actually at first I tried to use Transfer and TransferRequest method(HttpServerUtility Class) but It wasn't possible with HTTPHandler because these method only works with aspx pages. It looks that Transfer method has not popularity
in the community and in one of forums I found passing HTTPContext to Handler. I want to know is this possible with TransferRequest(because its asynchronous) when I use aspx instead of Handler? Also in one forum I read that sending multiple response is possible
but i don't sure it was ASP.NET or other technologies. Can please tell me about the possibility?