473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

is auth cookie still active

hi,

I have implemented forms authentication and it is woking well however I am
experiencing a slightly frustrating problem.
The "Admin" directory of my site is password protected, however if a user
successfully logs in to this section then will see a small menu at the top
of the page on
ANY page they are logged into, even it is outside the "Admin" directory.
Basically if you are an admin you see this menu and if you are not you
don't.
I achieve this with the following code
Dim encTicket As String
Dim ticket As System.Web.Security.FormsAuthenticationTicket
Dim currentUsername
Dim cookie As System.Web.HttpCookie
cookie =
Request.Cookies(System.Web.Security.FormsAuthentic ation.FormsCookieName)
If cookie Is Nothing Then
'The user is not logged in so do not display the menu
MenuLabel.Visible = False
Else
encTicket = cookie.Value
ticket =
System.Web.Security.FormsAuthentication.Decrypt(en cTicket)
currentUsername = ticket.Name
MenuLabel.Visible = True
End If

Now if a user logs in successfully and the has no activity on the client for
a certain period they are logged out and have to log back in again. This
also wors fine.
However if the user has been logged out the above code still thinks that the
user is still logged in. I guess the cookie is still on the client although
it has probabally expired.
My question is what would I have to add to the above code to determine that
the cookie has not expired.

cheers

Alex.
Nov 17 '05 #1
0 903

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jsWalter | last post by:
I have an extension Class to Auth and I'm looking for some folks to hammer on it a bit and give feed back. Class: AuthUser - add user (well, Auth does that now, so its gone) - remove user...
3
by: Dan Stromberg | last post by:
If I wanted to write a python script that performs basic auth, gets a cookie, and then does an http POST using the cookie for authentication, what would be the best python API to write to? Does...
0
by: Chris | last post by:
Hi, I am using an authentication cookie (generated on page load) of my asp.net application. I'm giving the cookie a lifespan of 20 minutes. If a user does something within that 20 minutes, it...
4
by: Alex | last post by:
hi, I have implemented forms authentication and it is woking well however I am experiencing a slightly frustrating problem. The "Admin" directory of my site is password protected, however if a...
4
by: 23s | last post by:
I had this problem in the past, after a server reformat it went away, and now after another server reformat it's back again - no clue what's doing it. Here's the flow: Website root is public, no...
5
by: Param R. | last post by:
Hi all, we are experiencing an issue with regards to the auth cookie and a load balanced server farm. The user may randomly hit any box in the server farm. If the users authenticates against 1 box...
0
by: Bill Borg | last post by:
Hello all, Not sure I can describe this adequately, but I am creating an endless loop when an authenticated user signs out. When the user signs out, I want to remove authentication, abandon...
13
by: Perecli Manole | last post by:
In the forms authentication construct, I need a way to prevent ticket IssueDate and Expiration from being updated for a specific page only. By default forms authentication updates these two values...
3
by: Thomas.Firnschrott | last post by:
i have a problem concerning a php script i worte some time ago. It is a rather simple thing. On a Site you login via a html form which points to a php that checks the username and password, and...
4
by: J. Frank Parnell | last post by:
The goal here is to use basic authentication for a user to log in, but keep a cookie so that they dont have to log in every browser session. <? $user = "user"; $pass = "pass"; ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.