Hey
Im devloping an application in asp.net 1.1 SP2. I need to control timeout
values for each user. Im having trouble to make it work. When the session
timouts out I want to redirect the user to the login page. OK.,
Im aware that we have 2 timeouts. Session timeout and forms authentication
timeout.
In login i do this
---------------
Response.Cookie s.Remove(FormsA uthentication.F ormsCookieName) ;
FormsAuthentica tionTicket ticket = new FormsAuthentica tionTicket(
1,
_username,
DateTime.Now,
DateTime.Now.Ad dMinutes(20), <<<<< HOW DO I CHANGE THIS VALUE WHILE USER
LOGED ON?
false,
_userid.ToStrin g(),
FormsAuthentica tion.FormsCooki ePath )
;
string encryptedTicket = FormsAuthentica tion.Encrypt(ti cket);
HttpContext.Cur rent.Response.C ookies.Add(
new HttpCookie(
FormsAuthentica tion.FormsCooki eName,
encryptedTicket )
);
HttpContext.Cur rent.Session["TimeoutVar "] = "";`
--------------
I have never gotten this to work so I tried to use the Session to control
this and tried something like this.
----------------
protected void Application_OnA cquireRequestSt ate(Object sender, EventArgs e)
{
if( User.Identity != null && User.Identity.I sAuthenticated &&
Session["TimeoutVar "] == null )
{
FormsAuthentica tion.SignOut();
this.Response.R edirect(this.Re quest.Applicati onPath + "/Default.aspx");
}
}
---------------
And in a derrived page template
----------------
override protected void OnInit(EventArg s e)
{
base.OnInit(e);
if(User.Identit y.IsAuthenticat ed)
{
if(Session.Time out != (Context.User.I dentity as
UserIdentity).U ser.Timeout)
{
Session.Timeout = (Context.User.I dentity as UserIdentity).U ser.Timeout;
} } }}
This works...Sometim es. But it randomly enter the IF clause in
OnAcquireReques tState and gets redirected. It varys alot from seconds but
sometimes servereal mintues.
Anyway. How is the "CORRECT" way to implement functionality that can set;
from user to user; logout interval.when using forms autentication.
NB: Session is inproc and set to 20 min in web.config (but is instantly
overriden by the codebehind reassign)
Thanks in regards
Anders 1 3595
Why don't you try using javascript for this.
Patrick
"Anders Jacobsen" <none> wrote in message
news:#5******** *****@TK2MSFTNG P10.phx.gbl... Hey
Im devloping an application in asp.net 1.1 SP2. I need to control timeout values for each user. Im having trouble to make it work. When the session timouts out I want to redirect the user to the login page. OK.,
Im aware that we have 2 timeouts. Session timeout and forms authentication timeout.
In login i do this --------------- Response.Cookie s.Remove(FormsA uthentication.F ormsCookieName) ; FormsAuthentica tionTicket ticket = new FormsAuthentica tionTicket( 1, _username, DateTime.Now, DateTime.Now.Ad dMinutes(20), <<<<< HOW DO I CHANGE THIS VALUE WHILE USER LOGED ON? false, _userid.ToStrin g(), FormsAuthentica tion.FormsCooki ePath ) ; string encryptedTicket = FormsAuthentica tion.Encrypt(ti cket); HttpContext.Cur rent.Response.C ookies.Add( new HttpCookie( FormsAuthentica tion.FormsCooki eName, encryptedTicket ) );
HttpContext.Cur rent.Session["TimeoutVar "] = "";` --------------
I have never gotten this to work so I tried to use the Session to control this and tried something like this. ---------------- protected void Application_OnA cquireRequestSt ate(Object sender, EventArgs
e) { if( User.Identity != null && User.Identity.I sAuthenticated && Session["TimeoutVar "] == null ) { FormsAuthentica tion.SignOut(); this.Response.R edirect(this.Re quest.Applicati onPath + "/Default.aspx"); } } ---------------
And in a derrived page template ---------------- override protected void OnInit(EventArg s e) { base.OnInit(e);
if(User.Identit y.IsAuthenticat ed) { if(Session.Time out != (Context.User.I dentity as UserIdentity).U ser.Timeout) { Session.Timeout = (Context.User.I dentity as UserIdentity).U ser.Timeout;
} } }}
This works...Sometim es. But it randomly enter the IF clause in OnAcquireReques tState and gets redirected. It varys alot from seconds but sometimes servereal mintues.
Anyway. How is the "CORRECT" way to implement functionality that can set; from user to user; logout interval.when using forms autentication.
NB: Session is inproc and set to 20 min in web.config (but is instantly overriden by the codebehind reassign)
Thanks in regards Anders
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: deko |
last post by:
I have a login page that is supposed to redirect the user to his private
page after login. But header("Location: $url") does not work after I set
the $_SESSION variable - I get "Warning: Cannot modify header information -
headers already sent by ...
The abbreviated code on the login page looks like this:
<?php
session_start();
?>
|
by: Robert.Tackett |
last post by:
OmniDotNet,
I am a DotNet newbie building a web based database application that users
will "sit" in for long periods of time without activity. So I need to know
the best way to recognize that a timeout has occured and redirect to a login
page. I know how to use Response.Redirect("PageGoesHere.aspx"), but not in
this situation.
Thank you for your time,
|
by: Donald Williamson |
last post by:
Hi
Hope someone can help me with authentication and how the redirects work. I'
ve already tried searching previous posts but didn't really find anything.
for I have a page that checks to see if the user has logged in. If not, it
redirects them to the login page for authentication. After authenticating, I
want to redirect them back to the original page that sent them. I always get
redirected back to the default page. I noticed that...
|
by: Ed Henn |
last post by:
I'm having a problem with .NET Forms Authentication in a particular
application. It's not redirecting properly when my session is timed
out, seemingly only when I POST the page (i.e. click a form submit
button). If I try to GET a page after timeout (i.e. just picking a page
to visit from a menu), I am redirected to the login screen properly.
The browser error I'm getting in the POST example is "403.1 Execute
Access Forbidden". I...
|
by: Ather Ali Shaikh |
last post by:
Hello
I am using Forms Authentication. but the page is not redirect to desired
login page after session is expired.
When I debug the application. Session_end is called.
In the Session_End method I write code to redirect to the LoginPage as
(response.redirect("Login.aspx") or server.transfer("Login.aspx")).
But it is not redirecting. It runs the redirecting code but physically not
redirect.
What should I do more.?
| |
by: Danny |
last post by:
Hi there,
I was wondering if anyone would be able to shed some light on the
following behaviour for me.
I have an application that is using Forms Authentication with
non-persistent cookies, a forms timeout of 10 minutes, and a
FormsAuthenticationTicket Expiration of 10 minutes. Almost everything is
working as expected... when users try to enter restricted parts of the
site they are redirected to the login.aspx page that I have...
|
by: Grey |
last post by:
I have set the following parameters in web.config to prevent user direct
access the web page without user login.
<authentication mode="Forms">
<forms loginUrl="Initial/index.aspx" name="adAuthCookie"
timeout="60" path="/" >
</forms>
</authentication>
The application did success to redirect to login page, but it cannot
redirect back to desire page which I specify in URL. What's wrong with my
|
by: Clare Strickson |
last post by:
Hi
Is it possible to redirect the user to a login page when the session has
timed out?
thanks in advance
David Strickson
|
by: j-in-uk |
last post by:
Hi,
I'm using the login control for asp.net 2.0.
Once a user logs in I want to set timeouts for certain pages not the
whole app,
so if the page they on has expired I want to redirect the user back to
login page.
I got the login control to work but need to know how to do the rest.
Do I use the Response.Cache.SetCacheability etc.
Any examples?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |