Kevin Pang
Kevin Pang

Reputation: 41442

How do I modify the timeout of an aspx page?

Is there a way to manually increase / decrease the timeout of a specific aspx page?

Upvotes: 8

Views: 10491

Answers (3)

Dillie-O
Dillie-O

Reputation: 29725

The one thing to remember with this is that the timeout feature here will only invalidate the Session Timeout, but the user will still remain on whatever page they are on. This may cause issues with the flow of the application. As a rememdy, I keep the following in my Web.config file:

<appSettings>
     <!-- Application Timeout is 10 minutes -->
     <add key="SessionTimeoutMilliseconds" value="600000"/>     
</appSettings>

In addition, my master page has the following code in my code behind file:

' Register Javascript timeout event to redirect to the login page after inactivity
Page.ClientScript.RegisterStartupScript(Me.GetType, "TimeoutScript", _
                                        "setTimeout(""top.location.href = '/EAF/Login.aspx'""," & _
                                        ConfigurationManager.AppSettings("SessionTimeoutMilliseconds") & ");", True)

and you should be all set on both ends.

Upvotes: 2

schmoopy
schmoopy

Reputation: 6649

If you are talking about the amount of time it takes before the page returns a timeout, then mnour's example - you may want to look at the machine.config file as well. If you talking about a session timing out, then you will need to use a JS timer that posts back when it reaches 0.

Upvotes: 0

mohammedn
mohammedn

Reputation: 2950

In the web.config:

   <configuration>
      <location path="~/Default.aspx">
        <system.web>
          <httpRuntime executionTimeout="1000"/>      
        </system.web>    
      </location>
   </configuration>

Upvotes: 8

Related Questions