Setting Server.ScriptTimeout programatically in ASP.NET not taking into effect

The reason behind it was that debug attribute was set to true inside web.config. If debug attribute is set to true, then batch compilation is diasbled <httpRuntime executionTimeout /> or calls to Server.ScriptTimeout is ignored.

To confirm, set the debug attribute to true and then request any aspx page. After that browse to Temporary ASP.NET files folder and locate application directory. Inside that directory locate the .cs or .vb file dynamically generated for the requested aspx page. Open that up and you will find

this.Server.ScriptTimeout = 30000000 by default even if you set Server.ScriptTimeout value in the Page Load.

For more information, please visit the url - https://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/monitor_perf.asp