Antoine Pelletier
Antoine Pelletier

Reputation: 3316

trying to put a timeOut in asp.net

I have a ASP.Net web application in witch i want to put a timeOut (for user that dosen't do anything for too much time). My test use a 3 secondes timeOut. In the web.config :

<sessionState mode="StateServer" stateNetworkTimeout="3"></sessionState>

I get the following error as soon as i run my app:

Cannot request session state in session state server.

I can't find anything relevante for this case...

i tried to put InProc in Mode="" but it dosen't timeout anything.

Upvotes: 0

Views: 2288

Answers (2)

Antoine Pelletier
Antoine Pelletier

Reputation: 3316

<sessionState mode="InProc"  timeout="1" cookieless="false" ></sessionState>

I mistaken secondes for minutes, the Timeout value is about minutes. So i waited 1 minute for my test...

Thanks to @Devian and @Agolo.

Upvotes: 0

tripdubroot
tripdubroot

Reputation: 1153

Looking at this, you're trying to use a State Server and set the idle time between the web server and the state server. To properly configure the web server to use a state server, you must also configure the state server. Go to your state server and run:

systemroot\Microsoft.NET\Framework\versionNumber\aspnet_state.exe

This will install the asp.net state service. Then in the sessionState element in your web config you will need to set the stateConnectionString attibute as well.

<configuration>
  <system.web>
    <sessionState mode="StateServer"
      stateConnectionString="tcpip=SampleStateServer:42424"
      cookieless="false"
      timeout="20"
      stateNetworkTimeout="3"/>
  </system.web>
</configuration>

You now have two "timeouts" here. The "timeout" attribute is how long the user can keep a connection to the webserver. The stateNetworkTimeout is how long the webserver to stateserver connection can be idle. The default is 10 seconds.

Hope this helps.

ref: https://msdn.microsoft.com/en-us/library/ms178586(v=vs.100).aspx

/ip

Upvotes: 1

Related Questions