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.
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).
ravi010mitta...
Member
159 Points
122 Posts
Cancel all previous requests to Generic Handler ?
Dec 22, 2012 05:38 AM|LINK
Hello World
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
Ravi Mittal
Ravi Mittal
Code Help Code
rstrahl
Contributor
2287 Points
387 Posts
ASPInsiders
MVP
Re: Cancel all previous requests to Generic Handler ?
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 ---
West Wind Technologies
Making waves on the Web
www.west-wind.com/weblog