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?
8 3253
You may want to use a timer, however threading may also be of use. When your application timesout what do you want to happen?
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
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.
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 ?
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.
-
<?xml version="1.0"?>
-
<configuration>
-
-
<!--<appSettings>
-
<add key="connectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Projects\.......
-
-
<appSettings>
-
'''connection string goes here.......
-
</appSettings>
-
-
-
-
-
<system.web>
-
<!--
-
Set compilation debug="true" to insert debugging
-
symbols into the compiled page. Because this
-
affects performance, set this value to true only
-
during development.
-
-
Visual Basic options:
-
Set strict="true" to disallow all data type conversions
-
where data loss can occur.
-
Set explicit="true" to force declaration of all variables.
-
-->
-
<!--<sessionState timeout="1" mode="InProc" />-->
-
<!--<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="" cookieless="false" timeout="120"/>-->
-
<!--<compilation debug="true" strict="false" explicit="true">-->
-
<compilation debug="false" strict="false" explicit="true">
-
<assemblies>
-
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
-
<add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
<add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
-
<add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
<add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
<add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
-
<add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
-
<add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
<add assembly="System.DirectoryServices.Protocols, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
<add assembly="System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
<add assembly="System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
<add assembly="System.Web.RegularExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
-
</assemblies>
-
</compilation>
-
<pages>
-
<namespaces>
-
<clear/>
-
<add namespace="System"/>
-
<add namespace="System.Collections"/>
-
<add namespace="System.Collections.Specialized"/>
-
<add namespace="System.Configuration"/>
-
<add namespace="System.Text"/>
-
<add namespace="System.Text.RegularExpressions"/>
-
<add namespace="System.Web"/>
-
<add namespace="System.Web.Caching"/>
-
<add namespace="System.Web.SessionState"/>
-
<add namespace="System.Web.Security"/>
-
<add namespace="System.Web.Profile"/>
-
<add namespace="System.Web.UI"/>
-
<add namespace="System.Web.UI.WebControls"/>
-
<add namespace="System.Web.UI.WebControls.WebParts"/>
-
<add namespace="System.Web.UI.HtmlControls"/>
-
</namespaces>
-
</pages>
-
<!--
-
The <authentication> section enables configuration
-
of the security authentication mode used by
-
ASP.NET to identify an incoming user.
-
-->
-
<!--<authentication mode="Forms">
-
<forms timeout="2"/>
-
</authentication>-->
-
<authentication mode="Forms">
-
<forms loginUrl="Login.aspx" timeout="2"/>
-
</authentication>
-
<!--<authentication mode="Windows"/>-->
-
-
<!--
-
The <customErrors> section enables configuration
-
of what to do if/when an unhandled error occurs
-
during the execution of a request. Specifically,
-
it enables developers to configure html error pages
-
to be displayed in place of a error stack trace.
-
-
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
-
<error statusCode="403" redirect="NoAccess.htm" />
-
<error statusCode="404" redirect="FileNotFound.htm" />
-
</customErrors>
-
-
-->
-
<customErrors mode="Off"/>
-
</system.web>
-
</configuration>
-
-
default.aspx
-
Page Load
-
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-
Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand
-
Dim oUser As pharm_users = New pharm_users(Page)
-
Dim oPatient As pharm_Patients = New pharm_Patients(Page)
-
Dim oConn As SqlClient.SqlConnection = Nothing
-
'Session.Timeout = 2
-
btnCancel.Attributes.Add("onClick", "return confirm('Press OK to abandon the data, or cancel to continue');")
-
btnSave.Attributes.Add("onClick", "return confirm('Press OK to Save and move to the next record');")
-
btnNoContact.Attributes.Add("onClick", "return confirm('Are you sure');")
-
-
theChoiceNew = CInt(Session.Item("the_Choice"))
-
theCaller = CInt(Session.Item("Pharm_user_id"))
-
If Not Page.IsPostBack Then
-
If Not oUser.IsLogin() Then
-
'Server.Transfer("./login.aspx")
-
Response.Redirect("https://www.sccpkh.com/login.aspx")
-
Else
-
etc....
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 -
<sessionState cookieless="true" timeout="1" mode="InProc" />
-
default.aspx -
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CollegeMain._Default" %>
-
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-
<html xmlns="http://www.w3.org/1999/xhtml" >
-
<head runat="server">
-
<title>Untitled Page</title>
-
</head>
-
<body>
-
<form id="form1" runat="server">
-
<div>
-
-
-
<asp:Label ID="lblMain" runat="server" Text="This should say Hello world!"></asp:Label>
-
-
</div>
-
</form>
-
</body>
-
</html>
-
default.aspx.cs -
protected void Page_Load(object sender, EventArgs e)
-
{
-
if (Session != null)
-
{
-
if (Session["Test"] != null)
-
{
-
lblMain.Text = (string)Session["Test"];
-
}
-
else
-
{
-
Session.Add("Test", "Hello world!");
-
}
-
}
-
else
-
{
-
Session.Add("Test", "Hello world!");
-
}
-
-
//Session.Timeout = 1;
-
/* uncomment the above and comment out the web.config line. Should have the same result */
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
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....
|
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
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
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,...
| |