Solved

Asp.Net: how-to modify timeout for users

Posted on 2004-08-13
10
211 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
  • 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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now