473,499 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Logg off users with session.timeout

I wonder if it is possible from a button click or a link to logg off (some
unwanted logged on users or all users) in an asp.net application with
session.timeout or another way?Thankfull for any code example.
Nov 19 '05 #1
9 1959
Here's what we do; if the session has expired or doesn't exist we
redirect to a "timed out" page. The timeout page contains only a
couple lines of javascript to pop up a box alerting the user that they
have timed out then redirects them back to the login page. We check
the session on every page to make sure it still exists.

in each page:
--------------------
If Session("User") Is Nothing Then
Response.Redirect("../TimedOut.aspx")
End If
timeout page:
--------------------
function window_onload()
{
alert('Your session has timed out. Please log back on.');
top.location.href = 'default.aspx';
}
I'd also like to hear what other people are using to see if we could
change our method to something better - or if this is the norm.

Thanks!
Michelle

Nov 19 '05 #2
Thanks Michelle for your answer but what I need is logging off certain users
when their sessions have not ended yet. Imagine that I'm an administrator and
want to expell some unwanted users from the applikation from a button click.
Is there any way maybe to use formsauthentication.signout() method? The
problem is how to identify first these users?
/Viktor

"Michelle" wrote:
Here's what we do; if the session has expired or doesn't exist we
redirect to a "timed out" page. The timeout page contains only a
couple lines of javascript to pop up a box alerting the user that they
have timed out then redirects them back to the login page. We check
the session on every page to make sure it still exists.

in each page:
--------------------
If Session("User") Is Nothing Then
Response.Redirect("../TimedOut.aspx")
End If
timeout page:
--------------------
function window_onload()
{
alert('Your session has timed out. Please log back on.');
top.location.href = 'default.aspx';
}
I'd also like to hear what other people are using to see if we could
change our method to something better - or if this is the norm.

Thanks!
Michelle

Nov 19 '05 #3
i believe it is the norm

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"viktor9990" <vi********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Thanks Michelle for your answer but what I need is logging off certain
users
when their sessions have not ended yet. Imagine that I'm an administrator
and
want to expell some unwanted users from the applikation from a button
click.
Is there any way maybe to use formsauthentication.signout() method? The
problem is how to identify first these users?
/Viktor

"Michelle" wrote:
Here's what we do; if the session has expired or doesn't exist we
redirect to a "timed out" page. The timeout page contains only a
couple lines of javascript to pop up a box alerting the user that they
have timed out then redirects them back to the login page. We check
the session on every page to make sure it still exists.

in each page:
--------------------
If Session("User") Is Nothing Then
Response.Redirect("../TimedOut.aspx")
End If
timeout page:
--------------------
function window_onload()
{
alert('Your session has timed out. Please log back on.');
top.location.href = 'default.aspx';
}
I'd also like to hear what other people are using to see if we could
change our method to something better - or if this is the norm.

Thanks!
Michelle

Nov 19 '05 #4
But how to use formsauthentication.signout() method to logg off all logged on
users at the same time from the application? Do I need to make any change in
web.config too?
/Viktor

"Alvin Bruney [Microsoft MVP]" wrote:
i believe it is the norm

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"viktor9990" <vi********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Thanks Michelle for your answer but what I need is logging off certain
users
when their sessions have not ended yet. Imagine that I'm an administrator
and
want to expell some unwanted users from the applikation from a button
click.
Is there any way maybe to use formsauthentication.signout() method? The
problem is how to identify first these users?
/Viktor

"Michelle" wrote:
Here's what we do; if the session has expired or doesn't exist we
redirect to a "timed out" page. The timeout page contains only a
couple lines of javascript to pop up a box alerting the user that they
have timed out then redirects them back to the login page. We check
the session on every page to make sure it still exists.

in each page:
--------------------
If Session("User") Is Nothing Then
Response.Redirect("../TimedOut.aspx")
End If
timeout page:
--------------------
function window_onload()
{
alert('Your session has timed out. Please log back on.');
top.location.href = 'default.aspx';
}
I'd also like to hear what other people are using to see if we could
change our method to something better - or if this is the norm.

Thanks!
Michelle


Nov 19 '05 #5
Put a button on a form, map its click event to a function that calls the
signout method. each user who chooses to log out follows the process.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"viktor9990" <vi********@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
But how to use formsauthentication.signout() method to logg off all logged
on
users at the same time from the application? Do I need to make any change
in
web.config too?
/Viktor

"Alvin Bruney [Microsoft MVP]" wrote:
i believe it is the norm

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"viktor9990" <vi********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
> Thanks Michelle for your answer but what I need is logging off certain
> users
> when their sessions have not ended yet. Imagine that I'm an
> administrator
> and
> want to expell some unwanted users from the applikation from a button
> click.
> Is there any way maybe to use formsauthentication.signout() method? The
> problem is how to identify first these users?
> /Viktor
>
> "Michelle" wrote:
>
>> Here's what we do; if the session has expired or doesn't exist we
>> redirect to a "timed out" page. The timeout page contains only a
>> couple lines of javascript to pop up a box alerting the user that they
>> have timed out then redirects them back to the login page. We check
>> the session on every page to make sure it still exists.
>>
>> in each page:
>> --------------------
>> If Session("User") Is Nothing Then
>> Response.Redirect("../TimedOut.aspx")
>> End If
>>
>>
>> timeout page:
>> --------------------
>> function window_onload()
>> {
>> alert('Your session has timed out. Please log back on.');
>> top.location.href = 'default.aspx';
>> }
>>
>>
>> I'd also like to hear what other people are using to see if we could
>> change our method to something better - or if this is the norm.
>>
>> Thanks!
>> Michelle
>>
>>


Nov 19 '05 #6
I don't know if you understood what I meant. What I need is from a button
click be able to logg off all users at the same time from the system (it is
me who will do that and not them one at a time)?
/Viktor

"Alvin Bruney [Microsoft MVP]" wrote:
Put a button on a form, map its click event to a function that calls the
signout method. each user who chooses to log out follows the process.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"viktor9990" <vi********@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
But how to use formsauthentication.signout() method to logg off all logged
on
users at the same time from the application? Do I need to make any change
in
web.config too?
/Viktor

"Alvin Bruney [Microsoft MVP]" wrote:
i believe it is the norm

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"viktor9990" <vi********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
> Thanks Michelle for your answer but what I need is logging off certain
> users
> when their sessions have not ended yet. Imagine that I'm an
> administrator
> and
> want to expell some unwanted users from the applikation from a button
> click.
> Is there any way maybe to use formsauthentication.signout() method? The
> problem is how to identify first these users?
> /Viktor
>
> "Michelle" wrote:
>
>> Here's what we do; if the session has expired or doesn't exist we
>> redirect to a "timed out" page. The timeout page contains only a
>> couple lines of javascript to pop up a box alerting the user that they
>> have timed out then redirects them back to the login page. We check
>> the session on every page to make sure it still exists.
>>
>> in each page:
>> --------------------
>> If Session("User") Is Nothing Then
>> Response.Redirect("../TimedOut.aspx")
>> End If
>>
>>
>> timeout page:
>> --------------------
>> function window_onload()
>> {
>> alert('Your session has timed out. Please log back on.');
>> top.location.href = 'default.aspx';
>> }
>>
>>
>> I'd also like to hear what other people are using to see if we could
>> change our method to something better - or if this is the norm.
>>
>> Thanks!
>> Michelle
>>
>>


Nov 19 '05 #7
viktor9990,
I guess u can only control how long they can stay on the site and what
they can do.But logging them all out at the same time?????


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #8
You have to use a bit of sideways thinking
to get around that type of logic.

If you think that logging everyone off is the problem,
you will not be able to do it from within code.

OTOH, if you know that all it takes to log everybody off
is to restart the application, there's a simple solution :

Write a little app to "touch" ( save ) global.asax.

That will restart the application
and everybody will be logged off.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
=====================

"Patrick Olurotimi Ige" <ig*@iprimus.com.au> wrote in message
news:e%****************@TK2MSFTNGP09.phx.gbl...
viktor9990,
I guess u can only control how long they can stay on the site and what
they can do.But logging them all out at the same time?????

Nov 19 '05 #9
I like your idea. I put the code in a header user control rather than
typing the code into every page and it works like a dream.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #10

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

Similar topics

4
3240
by: vesely | last post by:
Hi all, I'm currently relying on logged-in users hitting "logout" (logoff) before they leave, in order to terminate the session. With PHP the session filename is in a cookie that lasts for the...
4
15444
by: DavidS | last post by:
First: There are several ways to confuse one regarding session timeout. (1) web.config - <sessionState timeout="20"> (2) IIS Manager | Internet Information Services | ServerNode | Default Web Site...
5
5249
by: fbwhite | last post by:
I know this issue has been brought up many times, but I have tried many of the solutions to no avail. I wanted to give my specific case to see if someone could be of any help. We are using the...
17
5176
by: jensen bredal | last post by:
Hello, i'm struggling with a somehow badly understood session scenario. I provide acces to my pages based on form authentication using Session cookies. Som of my pages are supposed to be...
5
1854
by: jensen bredal | last post by:
I need to keep track on user "session data" while still turning session off as i do not want users login to expire? Thanks JB
4
9411
by: UJ | last post by:
I have a page where the user can upload a video file. As you can guess, this may take a while. Is there a way I can change the session timeout for just this one page? I would also want to change...
8
17244
by: Brendon Bezuidenhout | last post by:
Hey all, Newbie question I'm afraid: Is there a way to see/tell how many users are currently logged into a website at all? Thanks Brendon
1
1675
by: =?Utf-8?B?VCBSYXkgSHVtcGhyZXk=?= | last post by:
I have an ASP.NET 2.0 web app using forms authentication and an ASP.NET Membership database. Internal users access the app from the intranet, but they are authenticated by the membership module....
3
2329
by: =?Utf-8?B?V2luRGV2?= | last post by:
I have a weird one. My users will be on the system and suddenly get logged out. I have forms authentication turned on with a 1200 minute logout (I raised it that high to test this out.) Session...
0
7014
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
7180
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
7229
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...
1
6905
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...
0
7395
tracyyun
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...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
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...
0
1429
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 ...
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.