4
votes

Is there a way to set the idle timeout of application pool programmatically so that the session timeout set by the user in the web page will match that of the application pool?

2

2 Answers

5
votes

On IIS7+ you can use the Microsoft.Web.Administration library

http://msdn.microsoft.com/en-us/library/microsoft.web.administration.applicationpool%28v=vs.90%29.aspx

ApplicationPool.ProcessModel.IdleTimeout = TimeSpan.Zero;
1
votes

On IIS7 you could use Microsoft.Web.Administration assembly, look at ApplicationPool class

http://msdn.microsoft.com/en-us/library/microsoft.web.administration.applicationpool%28v=vs.90%29.aspx

I think that property that you are looking for is

ApplicationPool.Recycling.PeriodicRestart.Time

http://msdn.microsoft.com/en-us/library/microsoft.web.administration.applicationpoolrecycling%28v=VS.90%29.aspx