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

Forced user logout in 2.0

Hi all,

I want to perform the same action the the loginstatus control
does to logout a user programatically, but I can't seem to find
a 'logout' method in any of the membership classes.

The user gets authenticated using the login control and the build-in
database, but there are times when I want to logout the user and
send them back to the login page. At this point the "isAuthenticated"
method should return false.

Is there a logout method somewhere, and if not, is there a way
to perform all the steps manually to accomplish the same thing?

thanks
kpg
Nov 6 '07 #1
3 4984
LoginControl.Logout is a possibility. If using Forms Authentication
(likely), I believe the sign out method will yield the same results. I will
have to look to see if there are other methods.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
"kpg*" <no@spam.comwrote in message
news:Xn*******************************@207.46.248. 16...
Hi all,

I want to perform the same action the the loginstatus control
does to logout a user programatically, but I can't seem to find
a 'logout' method in any of the membership classes.

The user gets authenticated using the login control and the build-in
database, but there are times when I want to logout the user and
send them back to the login page. At this point the "isAuthenticated"
method should return false.

Is there a logout method somewhere, and if not, is there a way
to perform all the steps manually to accomplish the same thing?

thanks
kpg


Nov 6 '07 #2
This will do what you need:

Session.Abandon();
FormsAuthentication.SignOut();
Response.Redirect("~/Default.aspx");

--
Andrew Faust
http://www.andrewfaust.com
"kpg*" wrote:
Hi all,

I want to perform the same action the the loginstatus control
does to logout a user programatically, but I can't seem to find
a 'logout' method in any of the membership classes.

The user gets authenticated using the login control and the build-in
database, but there are times when I want to logout the user and
send them back to the login page. At this point the "isAuthenticated"
method should return false.

Is there a logout method somewhere, and if not, is there a way
to perform all the steps manually to accomplish the same thing?

thanks
kpg
Nov 6 '07 #3
=?Utf-8?B?QW5kcmV3IEZhdXN0?= <andrew [at] andrewfaust.comwrote in
news:23**********************************@microsof t.com:
This will do what you need:

Session.Abandon();
FormsAuthentication.SignOut();
Response.Redirect("~/Default.aspx");
Thanks, yes, that does it.
Nov 7 '07 #4

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

Similar topics

5
by: Michelle Stone | last post by:
Hi everybody I am writing a simple asp.net application using form authentication. I store the list of all users and their passwords in an SQL Server database table. My client recently told me...
2
by: NWx | last post by:
Hi, I have the following question: I have an app that uses user login/logout to identify users When user logon, I register logon time in a session variable When user logoff using the logout...
13
by: Mickey | last post by:
Hi all, Currently I use a timestamp to log users out after 15 minutes of inactivity. However I also need to log a user out if they have just left the page. I need to do this because I store...
4
by: Chumma Dede | last post by:
Hi, Is there any way in asp.net 1.1 to force a user to logout from an existing session on machine1, if that same userid logs in with a new session on another machine, say machine2? We are...
1
by: somaskarthic | last post by:
Hi In my portal , the condition is such that , using one username and password user should login in only one system at a time. User may not be able to login in different system with same user...
1
idsanjeev
by: idsanjeev | last post by:
how can check the user is logout if he is logout and try to go on previous page by using standard buttons toolsbar . i wants to can't allow to visit prevous page without relogin if he is logout.
11
mikek12004
by: mikek12004 | last post by:
In my page I want each user to get a unique id (which stays even if they go to another page and then come back) except when they click named "enter as other user". right now in the beginning of my...
1
by: 9966652260 | last post by:
hello I am currently doing a project on Administrator Module....where a Administrator has to know at this particular time how many users have logged in...... for which i...
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
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.