Be sure to set the idle timeout for the application pool as well:
http://weblogs.asp.net/aghausman/archive/2009/02/20/prevent-request-timeout-in-asp-net.aspx
According to the docs, you can set the timeout at anytime. Of course it has to be while during a request to the server! :-)
You could implement a custom Page attribute, like:
using System;
System.Web.SessionState;
public class TimeoutControlPage: System.Web.UI.Page {
public int Timeout {
get { return Session.Timeout; }
set { Session.Timeout = value; }
}
}
and then save the below page as "test.aspx":
<%@ Page Language="C#" Timeout="60" Inherits="TimeoutControlPage" %>
<html>
<body>
</body>
</html>