Solved

Asp.Net: how-to modify timeout for users

Posted on 2004-08-13
10
257 Views
Last Modified: 2010-04-07
Hello experts,
the timeout value in my Asp.Net (VB.Net) application is generally set in web.config to 10 minutes.
Now I want to modify this value for several users to 30 minutes.
How can I ensure that a new set value is used in all web pages for these users only.

If anyone knows a solution please supply appropriate [snippet] information.

   Thank you very much!

     HStrix
 
0
Comment
Question by:HStrix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11793037
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11793359
Sub Application_Start(Sender As Object, E As EventArgs)
  ' Application startup code goes here
End Sub

Sub Session_Start(Sender As Object, E As EventArgs)
  Response.Write("Session is Starting...<br>")
  Session.Timeout = 1
End Sub
0
 
LVL 8

Expert Comment

by:daffodils
ID: 11795038
AerosSaga is right..

You can use "Session_Start" in Global.asax to set the Session Timeout.
The Context.User.Identity.Name or Context.User.IsInRole properties can be used to conditionaly set the Session.Timeout property.

protected void Session_Start(Object sender, EventArgs e)
{
       if(Context.User.Identity.Name = "HStrix")
       {
      Session.Timeout = 30;
       }

       if(this.Context.User.IsInRole = "Admin")
       {
      Session.Timeout = 30;
       }
}
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 8

Expert Comment

by:daffodils
ID: 11795153
Wait.. those functions have syntax errors. I am sorry... I can't believe I missed that !!!!!

if(Context.User.Identity.Name == "HStrix")
{
   Session.Timeout = 30;
}
if(this.Context.User.IsInRole("Admin"))
{
   Session.Timeout = 30;
}
0
 

Author Comment

by:HStrix
ID: 11798969
Thank you for your comments.

Because ,
   I'm using InProc session management.
   I don't use Windows authentication.
and
   My application has its own user management.
   I'm using a session variable Session("UserID") to identify a user.

Can I use  Session("UserID") in Session_Start too?

0
 

Author Comment

by:HStrix
ID: 11799107
I forgot to mention that I also don't use cookies.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11799771
when does userID get assigned?
0
 

Author Comment

by:HStrix
ID: 11799828
When the application starts,
a login screen appears asking for an id with a password.
This will be compared with an information read from a  database.
If it was successful, the accepted userid is moved into the session variable.
This session variable is used through the entire life of the session,
i.e. until a logoff or a timeout.
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 500 total points
ID: 11800236
yes that will be fine, just wanted to make sures you let session start first.  I would use the page load event.

Regards,

Aeros
0
 

Author Comment

by:HStrix
ID: 11801109
Thank you very much.
Ii is working now.
   
   HStrix
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question