Solved

Asp.Net: how-to modify timeout for users

Posted on 2004-08-13
10
225 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I use this extension method? 8 47
Hidden Field Value 10 62
Turn on intranet settings 1 42
.NET tools for adding thread safety to a web app? 3 19
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

19 Experts available now in Live!

Get 1:1 Help Now