MrEff
MrEff

Reputation: 89

Set timeout for large file download

I have a ASPX WebForms site where the user can request a file download. The download link is a LinkButton that calls Response.Redirect() to a .ashx file.

I need to modify it so that if it doesn't return in 20 seconds, it makes a different call to a webservice that queues the request for asynchronous processing. The problem is, I don't know how to set the timeout of a Response.Redirect.

The only place I know to set a timeout is a JQuery.Ajax call, which does not seem to download the file at all. I also need to be able to test for the timeout so I can make the alternate call and adjust the UI. I have some leeway in how I can structure it; for example, I read a blog saying to create an iframe and set iframe.src to the downloader .ashx. This works, but again I can't specify a timeout.

Upvotes: 2

Views: 1709

Answers (1)

user1172023
user1172023

Reputation:

I don't think this solves your problem but you can set the timeout for a page in web.config. For example,

 <location path="Page.aspx">
    <system.web>
        <httpRuntime executionTimeout="60" />
    </system.web>
</location>

ASP.NET HTTP runtime settings.

Upvotes: 2

Related Questions