473,387 Members | 1,650 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,387 software developers and data experts.

FormsAuthentication and Session

Joe
I'm using FormsAuthentication and need to track a user id (int) along with
the user name. I was trying to store the user id under the Session but if
the user closes the browser and opens another browser and goes back to the
page the user is still logged in.

I have 2 choices:
1 - Log the user out whenever the browser is closed
2 - Store the user id in a cookie.

I would prefer option 1 but I don't know how to Sign out the user when the
browser is closed and the session is no longer valid.
Nov 19 '05 #1
2 1296
"Joe" <J_no_spam@_no_spam_Fishinbrain.com> wrote in
news:#b*************@TK2MSFTNGP09.phx.gbl:
I'm using FormsAuthentication and need to track a user id (int) along
with the user name. I was trying to store the user id under the
Session but if the user closes the browser and opens another browser
and goes back to the page the user is still logged in.

I have 2 choices:
1 - Log the user out whenever the browser is closed
2 - Store the user id in a cookie.

I would prefer option 1 but I don't know how to Sign out the user when
the browser is closed and the session is no longer valid.


You can extend the IPrincipal and IIdentity
(FormsIdentitiy/GenericIdentity) interfaces to add custom data to your
user clasess.

This page sort of explains the process and does a bit more too:

http://www.codeproject.com/aspnet/ro...entication.asp
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
Why don't you use FormsAuthSignOut()
And then use Session.Abandon..
Hope that helps..
or PS do it in the Global.asax
Patrick

"Joe" <J_no_spam@_no_spam_Fishinbrain.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
I'm using FormsAuthentication and need to track a user id (int) along with
the user name. I was trying to store the user id under the Session but if
the user closes the browser and opens another browser and goes back to the
page the user is still logged in.

I have 2 choices:
1 - Log the user out whenever the browser is closed
2 - Store the user id in a cookie.

I would prefer option 1 but I don't know how to Sign out the user when the
browser is closed and the session is no longer valid.

Nov 19 '05 #3

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

Similar topics

5
by: Jeff Johnson | last post by:
I'm using forms authentication to protect a subfolder within my site. I've got it working fine except for two issues: (1) When I do a RedirectFromLogin page I have to put a cookie path ("/"...
2
by: tshad | last post by:
I have a logon page that is may be called by the Forms Authentication setup. This would put a ReturnURL as part of the URL. I would normally then just issue a: ...
4
by: Matthias S. | last post by:
Hi there, I've created an application which is using Forms-based authentification. My Login-Button event handler looks somewhat like this: // validate the input, etc... // sUserName holds now...
1
by: Craig | last post by:
I'm using FormsAuthentication. If the session restarts, obviously the session variables are cleared, but the security ticket is still active. Since I use variables in the Session to determine what...
5
by: Åženol Akbulak | last post by:
Hello; I use in my web application FormsAuthentication. Also I use Session state (InProc). When a user logged in, I can read Session parameters. (For example Session). Problem is that, when...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
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,...
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.