Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 07, 2013 10:03 PM by rstrahl
Dec 22, 2012 05:38 AM|LINK
I am facing an issue with Generic Handler. Actually i am downloading TIFF images to Silverlight Client From Generic Handler. I send requests one by one to 15-20 images on Page Load using a Background Worker. Now i want that when user click on Back button
i need to cancel all requests to Generic Handler.
Hope you understand my problem
Thanks & Regards
Jan 07, 2013 10:03 PM|LINK
You can cancel connections by closing the connection and calling Response.End() on a connection easily enough.
However, there's no built in way to track connections or to 'go back' to an existing server Request connection unless the request stays active or you somehow cache the Context object in your work threads.
If you know you will have disconnections as part of your requests, you should consider sending back small chunks via HTTP ranges to your client rather than large files. This way the server is not tied up sending down very large files that can't be stopped
- you'd only send a smaller chunk at a time and when the chunk is done the client would request the next. If no next chunk is requested the server doesn't have to do any further work.
Definitely more work, but a better implementation if disconnection is a concern.
Note your server side code can also check whether the client has disconnected. if you're sending data down to the client in coded chunks (ie. you're manually streaming the data by writing small blocks into the OutputStream) you can check before each write
to see whether the client is still connected (ie. has aborted the request from the client side).
+++ Rick ---