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?
Open the web. config file, then increase the value in minutes by using the time out attribute of SessionState element. By default, the session timeout value is 20 minutes. Also in your case if you are using forms authentication, please check the timeout value.
By default, the ASP.NET MVC session timeout value is 20 minutes. For automatic Logout from Asp.net Identity when the user is Inactive, you have to use the below code in the Startup. cs file. The login page will be automatically redirected after 30 mins if the user is inactive.
You can set this programmatically in the controller:-
HttpContext.Current.Server.ScriptTimeout = 300;
Sets the timeout to 5 minutes instead of the default 110 seconds (what an odd default?)
<location path="ControllerName/ActionName"> <system.web> <httpRuntime executionTimeout="1000"/> </system.web> </location>
Probably it is better to set such values in web.config instead of controller. Hardcoding of configurable options is considered harmful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With