Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Asp.Net: how-to modify timeout for users

Posted on 2004-08-13
10
Medium Priority
?
259 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

670 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