473,407 Members | 2,320 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,407 software developers and data experts.

Gracefully Handling Logged Out User

I'm using Forms Based Authentication.

I've written my code so that when a user does something but has timed out,
it gracefully logs them out and asks them to log back on.

I do this with . .

Session.Abandon()
Response.Redirect("logon.aspx")

That puts them back to logon, but then they end up back at the default page
instead of where they where when they timed out.

What's the better way to handle that?

--

Steve Evans
Email Services
SDSU Foundation
(619) 594-0708

Nov 18 '05 #1
6 1751
You'd better use Viewstate to store the current request url . then
logon.aspx will check the url, if it exists, redirect to it.
I'm using Forms Based Authentication.

I've written my code so that when a user does something but has timed out,
it gracefully logs them out and asks them to log back on.

I do this with . .

Session.Abandon()
Response.Redirect("logon.aspx")

That puts them back to logon, but then they end up back at the default page instead of where they where when they timed out.

What's the better way to handle that?

--

Steve Evans
Email Services
SDSU Foundation
(619) 594-0708

Nov 18 '05 #2
So on my logoff code I did the following

Session.Abandon();
Session["URL"] = http://server/file.aspx;
Response.Redirect("logon.aspx");
Then on the logon.aspx code I did the follwoing after the authentication
takes place

if(Session["URL"] != null)
Response.Redirect((string)Session["URL"]);
else
Response.Redirect(FormsAuthentication.GetRedirectU rl(tbEmail.Text,
false)
it never goes through the true branch. It appears that I'm losing my
Session["URL"] from the original page. Is the Session.Abandon doing that
even though I'm saving a SessionState value after I run that?

--

Steve Evans
Email Services
SDSU Foundation
(619) 594-0708
"Edward" <zi***@citiz.net> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
You'd better use Viewstate to store the current request url . then
logon.aspx will check the url, if it exists, redirect to it.
I'm using Forms Based Authentication.

I've written my code so that when a user does something but has timed out, it gracefully logs them out and asks them to log back on.

I do this with . .

Session.Abandon()
Response.Redirect("logon.aspx")

That puts them back to logon, but then they end up back at the default

page
instead of where they where when they timed out.

What's the better way to handle that?

--

Steve Evans
Email Services
SDSU Foundation
(619) 594-0708


Nov 18 '05 #3
I recommend you put it in the query string instead of session.

"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:O6*************@TK2MSFTNGP12.phx.gbl...
So on my logoff code I did the following

Session.Abandon();
Session["URL"] = http://server/file.aspx;
Response.Redirect("logon.aspx");
Then on the logon.aspx code I did the follwoing after the authentication
takes place

if(Session["URL"] != null)
Response.Redirect((string)Session["URL"]);
else
Response.Redirect(FormsAuthentication.GetRedirectU rl(tbEmail.Text,
false)
it never goes through the true branch. It appears that I'm losing my
Session["URL"] from the original page. Is the Session.Abandon doing that
even though I'm saving a SessionState value after I run that?

--

Steve Evans
Email Services
SDSU Foundation
(619) 594-0708
"Edward" <zi***@citiz.net> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
You'd better use Viewstate to store the current request url . then
logon.aspx will check the url, if it exists, redirect to it.
I'm using Forms Based Authentication.

I've written my code so that when a user does something but has timed out, it gracefully logs them out and asks them to log back on.

I do this with . .

Session.Abandon()
Response.Redirect("logon.aspx")

That puts them back to logon, but then they end up back at the default

page
instead of where they where when they timed out.

What's the better way to handle that?

--

Steve Evans
Email Services
SDSU Foundation
(619) 594-0708



Nov 18 '05 #4
Great idea.

Now my only problem is certain state I would like to keep.

For example I have a webpage that allows you to update certain information
about yourself. If someone updates some info about themselves, times out,
then tries to update, right now I run Session.Abandon, then redirect them to
the logon page. After they logon though all the changes they made are lost.

Is there anyway to save those changes other than putting all of it in a
query string?

--

Steve Evans
Email Services
SDSU Foundation
(619) 594-0708
"Marina" <so*****@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP09.phx.gbl...
I recommend you put it in the query string instead of session.

"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:O6*************@TK2MSFTNGP12.phx.gbl...
So on my logoff code I did the following

Session.Abandon();
Session["URL"] = http://server/file.aspx;
Response.Redirect("logon.aspx");
Then on the logon.aspx code I did the follwoing after the authentication
takes place

if(Session["URL"] != null)
Response.Redirect((string)Session["URL"]);
else
Response.Redirect(FormsAuthentication.GetRedirectU rl(tbEmail.Text,
false)
it never goes through the true branch. It appears that I'm losing my
Session["URL"] from the original page. Is the Session.Abandon doing that even though I'm saving a SessionState value after I run that?

--

Steve Evans
Email Services
SDSU Foundation
(619) 594-0708
"Edward" <zi***@citiz.net> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
You'd better use Viewstate to store the current request url . then
logon.aspx will check the url, if it exists, redirect to it.

> I'm using Forms Based Authentication.
>
> I've written my code so that when a user does something but has timed
out,
> it gracefully logs them out and asks them to log back on.
>
> I do this with . .
>
> Session.Abandon()
> Response.Redirect("logon.aspx")
>
> That puts them back to logon, but then they end up back at the

default page
> instead of where they where when they timed out.
>
> What's the better way to handle that?
>
> --
>
> Steve Evans
> Email Services
> SDSU Foundation
> (619) 594-0708
>
>
>



Nov 18 '05 #5
"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm using Forms Based Authentication.

I've written my code so that when a user does something but has timed out,
it gracefully logs them out and asks them to log back on.

I do this with . .

Session.Abandon()
Response.Redirect("logon.aspx")


Session has nothing to do with Forms Authentication.

If the login has timed out, and if they user attempts to access a page which
requires that they be authenticated, then Forms Authentication will
automatically redirect them to the login page. When it does, the URL they
requested will be in the ReturnUrl query parameter. This way, when
RedirectFromLoginPage is called, they'll go right back to the page they had
requested, and Session state will still be intact.

The one issue you'll see is that, if the request which required
authentication was a postback, then the form variables will not be available
when the redirect to the requested page occurs, so they will lose their
changes. It will be as though they had hit the browser Refresh button. If
you don't abandon the Session, they will at least be able to get back to
where they were on the last successful postback.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #6
You're right. What I've really been doing to myself is losing my state when
I update the bin directory. I guess that is pretty significantly different
than timing out.

--

Steve Evans
Email Services
SDSU Foundation
(619) 594-0708
"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm using Forms Based Authentication.

I've written my code so that when a user does something but has timed out, it gracefully logs them out and asks them to log back on.

I do this with . .

Session.Abandon()
Response.Redirect("logon.aspx")
Session has nothing to do with Forms Authentication.

If the login has timed out, and if they user attempts to access a page

which requires that they be authenticated, then Forms Authentication will
automatically redirect them to the login page. When it does, the URL they
requested will be in the ReturnUrl query parameter. This way, when
RedirectFromLoginPage is called, they'll go right back to the page they had requested, and Session state will still be intact.

The one issue you'll see is that, if the request which required
authentication was a postback, then the form variables will not be available when the redirect to the requested page occurs, so they will lose their
changes. It will be as though they had hit the browser Refresh button. If
you don't abandon the Session, they will at least be able to get back to
where they were on the last successful postback.
--
John Saunders
johnwsaundersiii at hotmail

Nov 18 '05 #7

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

Similar topics

4
by: john | last post by:
How do u guys handle multiple sessions?? i.e, opening different browser windows by running iexplore.exe or clicking IE icons and opening the application. My sessions are mixing up. what i mean is...
34
by: rawCoder | last post by:
I have read that Exception Handling is expensive performance wise ( other than Throw ) , but exactly how ? Please consider the following example ... ////////////////// Code Block 1...
4
by: William F. Robertson, Jr. | last post by:
One of my developers came to me with this question and I don't have an answer for them. The only suggestion I had for them was to change the return to a output parameter and put a try catch around...
4
by: Al Williams | last post by:
Hi, I have error handling in place throughout my application. I also start the application wrapped in error handling code to catch any unexpected exceptions (i.e. exceptions that occur where I...
1
by: LilC | last post by:
I'm creating an application that has a standard layout for all pages. The information that is displayed in the layout will be dynamic based on the user that is logged in. Thus when a page is...
6
by: somaskarthic | last post by:
Hi This is somas here. I asked query about detecting the browser close event using javascript. I want to detect the event only when the X button in the top right corner is clicked and not else...
9
by: Chad | last post by:
This might be a bit vague and poorly worded..... In my program, I handle function failures using fprintf() and exit() like: fprintf(stderr, "malloc failed"); exit(EXIT_FAILURE); There...
94
by: Chad | last post by:
On to top of page 163 in the book "The C Programming Langauge" by K & R, they have the following: char *strdup(char *s) { char *p; p=(char *)malloc(strlen(s)+1); if( p != NULL) strcpy(p,s):...
9
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...

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.