473,395 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Vb.net web application Timeout issue

I have created a web application, and I want it to time out after a period of inactivity.
The web is hosted by godaddy, and has SQL server2005

In the Web.Config page I have added

<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="" cookieless="false" timeout="120"/>

<authentication mode="Forms">
<forms timeout="2"/>
</authentication>

I also have
<compilation debug="false" strict="false" explicit="true">

and in the form.load I have
Session.Timeout = 2

I've tried various combinations of these, but in no case does the application EVER TIMEOUT after any period of inactivity. I am new to this stuff and am surprised I've already gotten this far. What am I missing with getting it to timeout?
Jul 25 '08 #1
8 3253
kenobewan
4,871 Expert 4TB
You may want to use a timer, however threading may also be of use. When your application timesout what do you want to happen?
Jul 25 '08 #2
You may want to use a timer, however threading may also be of use. When your application timesout what do you want to happen?
I'd prefer to have the user redirected to the login page (login.aspx), but I don't understand why timeout doesn't have any effect.
I'm very new, and don't know what threading means.
Thanks for the reply
Jul 25 '08 #3
TRScheel
638 Expert 512MB
I'd prefer to have the user redirected to the login page (login.aspx), but I don't understand why timeout doesn't have any effect.
I'm very new, and don't know what threading means.
Thanks for the reply
Are you running the project in release? Or debug? I see that you set the setting but if you launch it in VS as debug it will override it.
Jul 25 '08 #4
Are you running the project in release? Or debug? I see that you set the setting but if you launch it in VS as debug it will override it.
I compiled it and uploaded to the web, with the debug mode turned off. However I don't know if there are other settings that determine debug or release. What is VS ?
Jul 25 '08 #5
TRScheel
638 Expert 512MB
I compiled it and uploaded to the web, with the debug mode turned off. However I don't know if there are other settings that determine debug or release. What is VS ?
Sorry, Visual Studio. I am used to just referring to is as VS.

Could you post a sample web.config omitting secure lines with a sample login.aspx and inside page that requires logging in to see based off your code?

Again, emphasizing omitting secure lines. I dont need to see any sql connection strings, etc.
Jul 25 '08 #6
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <configuration>
  3.  
  4.   <!--<appSettings>
  5.     <add key="connectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Projects\.......
  6.  
  7.   <appSettings>
  8.     '''connection string goes here.......    
  9.   </appSettings>
  10.  
  11.  
  12.  
  13.  
  14.   <system.web>
  15.    <!-- 
  16.             Set compilation debug="true" to insert debugging 
  17.             symbols into the compiled page. Because this 
  18.             affects performance, set this value to true only 
  19.             during development.
  20.  
  21.             Visual Basic options:
  22.             Set strict="true" to disallow all data type conversions 
  23.             where data loss can occur. 
  24.             Set explicit="true" to force declaration of all variables.
  25.         -->
  26.     <!--<sessionState timeout="1" mode="InProc" />--> 
  27.  <!--<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="" cookieless="false" timeout="120"/>-->
  28.     <!--<compilation debug="true" strict="false" explicit="true">-->
  29.     <compilation debug="false" strict="false" explicit="true">     
  30.     <assemblies>
  31.         <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  32.         <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  33.         <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  34.         <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  35.         <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  36.         <add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  37.         <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  38.         <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  39.         <add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  40.         <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  41.         <add assembly="System.DirectoryServices.Protocols, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  42.         <add assembly="System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  43.         <add assembly="System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  44.         <add assembly="System.Web.RegularExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  45.       </assemblies>
  46.     </compilation>
  47.     <pages>
  48.       <namespaces>
  49.         <clear/>
  50.         <add namespace="System"/>
  51.         <add namespace="System.Collections"/>
  52.         <add namespace="System.Collections.Specialized"/>
  53.         <add namespace="System.Configuration"/>
  54.         <add namespace="System.Text"/>
  55.         <add namespace="System.Text.RegularExpressions"/>
  56.         <add namespace="System.Web"/>
  57.         <add namespace="System.Web.Caching"/>
  58.         <add namespace="System.Web.SessionState"/>
  59.         <add namespace="System.Web.Security"/>
  60.         <add namespace="System.Web.Profile"/>
  61.         <add namespace="System.Web.UI"/>
  62.         <add namespace="System.Web.UI.WebControls"/>
  63.         <add namespace="System.Web.UI.WebControls.WebParts"/>
  64.         <add namespace="System.Web.UI.HtmlControls"/>
  65.       </namespaces>
  66.     </pages>
  67.     <!--
  68.             The <authentication> section enables configuration 
  69.             of the security authentication mode used by 
  70.             ASP.NET to identify an incoming user. 
  71.         -->
  72.     <!--<authentication mode="Forms">
  73.       <forms timeout="2"/>
  74.     </authentication>-->
  75.     <authentication mode="Forms">
  76.       <forms loginUrl="Login.aspx" timeout="2"/>
  77.     </authentication>
  78.     <!--<authentication mode="Windows"/>-->
  79.  
  80.     <!--
  81.             The <customErrors> section enables configuration 
  82.             of what to do if/when an unhandled error occurs 
  83.             during the execution of a request. Specifically, 
  84.             it enables developers to configure html error pages 
  85.             to be displayed in place of a error stack trace.
  86.  
  87.         <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
  88.             <error statusCode="403" redirect="NoAccess.htm" />
  89.             <error statusCode="404" redirect="FileNotFound.htm" />
  90.         </customErrors>
  91.  
  92.         -->
  93.         <customErrors mode="Off"/>
  94.   </system.web>
  95. </configuration>
  96.  
Expand|Select|Wrap|Line Numbers
  1. default.aspx
  2. Page Load
  3.  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  4.         Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand
  5.         Dim oUser As pharm_users = New pharm_users(Page)
  6.         Dim oPatient As pharm_Patients = New pharm_Patients(Page)
  7.         Dim oConn As SqlClient.SqlConnection = Nothing
  8.         'Session.Timeout = 2
  9.         btnCancel.Attributes.Add("onClick", "return confirm('Press OK to abandon the data, or cancel to continue');")
  10.         btnSave.Attributes.Add("onClick", "return confirm('Press OK to Save and move to the next record');")
  11.         btnNoContact.Attributes.Add("onClick", "return confirm('Are you sure');")
  12.  
  13.         theChoiceNew = CInt(Session.Item("the_Choice"))
  14.         theCaller = CInt(Session.Item("Pharm_user_id"))
  15.         If Not Page.IsPostBack Then
  16.             If Not oUser.IsLogin() Then
  17.                 'Server.Transfer("./login.aspx")
  18.                                 Response.Redirect("https://www.sccpkh.com/login.aspx")
  19.                             Else
  20.  
etc....
Jul 25 '08 #7
Curtis Rutland
3,256 Expert 2GB
Code tags are a requirement.

Please read the Posting Guidelines

MODERATOR
Jul 25 '08 #8
TRScheel
638 Expert 512MB
Looking at your code I cant find any reason why it wont work. I would suggest tearing it down and trying small samples like the below. Its in C# but the small segments of code should be fairly understandable from a VB .NET view. If you load the page the first time it will say "This should say Hello World" and if you refresh immediately it will say "Hello World". After a minute the session will timeout and reset the process. If your production server has the same result I would suspect there is more to your code than what you are showing, perhaps something holding the session or refreshing it.

web.config
Expand|Select|Wrap|Line Numbers
  1. <sessionState cookieless="true" timeout="1" mode="InProc" />
  2.  
default.aspx
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CollegeMain._Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Untitled Page</title>
  8. </head>
  9. <body>
  10.     <form id="form1" runat="server">
  11.     <div>
  12.  
  13.  
  14.         <asp:Label ID="lblMain" runat="server" Text="This should say Hello world!"></asp:Label>
  15.  
  16.     </div>
  17.     </form>
  18. </body>
  19. </html>
  20.  
default.aspx.cs
Expand|Select|Wrap|Line Numbers
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3.     if (Session != null)
  4.     {
  5.         if (Session["Test"] != null)
  6.         {
  7.             lblMain.Text = (string)Session["Test"];
  8.         }
  9.         else
  10.         {
  11.             Session.Add("Test", "Hello world!");
  12.         }
  13.     }
  14.     else
  15.     {
  16.         Session.Add("Test", "Hello world!");
  17.     }
  18.  
  19.     //Session.Timeout = 1;
  20.     /* uncomment the above and comment out the web.config line. Should have the same result */
  21. }
  22.  
Jul 25 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: E Sullivan | last post by:
I am having a time out issue when multiple users are accessing the server. This time out does not happen all of the time. My understanding is that the time out value is actually set in two places....
2
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET ...
6
by: B B | last post by:
Okay, here is what's happening: I have a reasonably fast laptop (1.4 GHz Mobile M, so comparable to 2.5GHz P4) doing .net development. Running Windows XP pro, SP2 IIS is installed and running...
4
by: Jeremy S | last post by:
I have written an ASP.NET application that performs very well. I make heavy use of the Cache and otherwise minimize the number of round trips to to the db. I couldn't be happier with the...
4
by: Frank Walsh | last post by:
Hi, I'm experiencing a problem when my asp.net 1.1 application starts. It appears that when the application has not been used for 12 hours or so...I experience a much longer load time then if...
1
by: Greg Allen | last post by:
I have a timeout issue with a long running web service, and I can't figure out where the timeout value is coming from. In the client I end up getting the following exception: The underlying...
1
by: mingki | last post by:
Hi Developers, I am a .Net developer of a Large Online Retailling Company. I would like to have your help on a Connection Pool issue. Recently we have developed a Web Application on ODP .Net...
2
by: Frank_00001 | last post by:
I've migrated an application from VS 2003 to VS 2005. It worked fine in 2003; but I've been having issue in 2005. The latest is dealing with a DataSet that I have as an Application Variable. It...
10
by: Atul Shukla | last post by:
Hi, How can I avoid application timeout? Generally a web application time out is 20 minutes, however, we can define this timeout in web.config to any number of minutes. After giving 500 minutes of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.