tags:

views:

414

answers:

1

I want to increase the request timeout for a specific controller action in my application. I know I can do it in the web.config for the entire application, but I'd rather change it on just this one action.

Web.config example:

<system.web>
  <httpRuntime executionTimeout="1000" /> 
</system.web>

How do I do it? Thanks,

Kyle

+4  A: 

You can set this programmatically in the controller:-

HttpContext.Server.ScriptTimeout = 300;

Sets the timeout to 5 minutes instead of the default 110 seconds (what an odd default?)

AnthonyWJones
With the advent of the AsyncController it's worth remembering that to get a similar effect for asynchronous requests you should use the [AsyncTimeout] property.
Jason