Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > FormsAuthentication.SignOut() problem

Reply
Thread Tools

FormsAuthentication.SignOut() problem

 
 
Zagor
Guest
Posts: n/a
 
      11-10-2004

Hi All, (thanks in advance for your time)
I have a standard login.aspx page (UserName\Password). When the user
successully sign in they are redirected to a control panel page
(admin.aspx), which contains a logout button with this code

private void OnLogOutClicked(......)
{
FormsAuthentication.SignOut();
lbStatus.Text= "You have successfully log out";
}

in this same page on PageLoad I have the below code

private void Page_Load(.....)
{
if ( Request.IsAuthenticated = = true ) {...
lbStatus.Text = "User" + User.Identity.Name + "is currenlty logged
in";}
}

The problem is that when the user clicks the "Log Out" button the label
status gets updated(fine) and if the user clicks any other buttons(on the
page) they will be automatically redirect to the login page (fine), which
basically confirm that he\she is logout and no operation can be done on the
page.
Now if I try to type in, the address manually I will be now able to access
the page ( even is no operation can be done) but the label status get
updated as logged in , which means that the user is STILL authenticated. How
can ensure that if your are logged out , the Request.IsAuthenticated will be
false!
Please any help willl be appreciated

Frank


 
Reply With Quote
 
 
 
 
Hernan de Lahitte
Guest
Posts: n/a
 
      11-10-2004
This might be a page local caching issue. When you manually call your
authenticated page (write down the absolute URL to the address bar, what you
actually see is the local cached copy of that page so you are not executing
code on the server side. If you try to do anything that may trigger a server
side event, then you will be redirected to your login page.
If you don´t what your page to be cached locally, you may add this code to
the page load event:

this.Response.Cache.SetCacheability( HttpCacheability.NoCache );


Hernan de Lahitte
http://weblogs.asp.net/hernandl



"Zagor" <> escribió en el mensaje
news:...
>
> Hi All, (thanks in advance for your time)
> I have a standard login.aspx page (UserName\Password). When the user
> successully sign in they are redirected to a control panel page
> (admin.aspx), which contains a logout button with this code
>
> private void OnLogOutClicked(......)
> {
> FormsAuthentication.SignOut();
> lbStatus.Text= "You have successfully log out";
> }
>
> in this same page on PageLoad I have the below code
>
> private void Page_Load(.....)
> {
> if ( Request.IsAuthenticated = = true ) {...
> lbStatus.Text = "User" + User.Identity.Name + "is currenlty logged
> in";}
> }
>
> The problem is that when the user clicks the "Log Out" button the label
> status gets updated(fine) and if the user clicks any other buttons(on the
> page) they will be automatically redirect to the login page (fine), which
> basically confirm that he\she is logout and no operation can be done on
> the page.
> Now if I try to type in, the address manually I will be now able to access
> the page ( even is no operation can be done) but the label status get
> updated as logged in , which means that the user is STILL authenticated.
> How can ensure that if your are logged out , the Request.IsAuthenticated
> will be false!
> Please any help willl be appreciated
>
> Frank
>



 
Reply With Quote
 
 
 
 
Zagor
Guest
Posts: n/a
 
      11-10-2004
Hi Hernan,
thank you, you got it!
That was the problem.

Frank



"Hernan de Lahitte" <> wrote in message
news:...
> This might be a page local caching issue. When you manually call your
> authenticated page (write down the absolute URL to the address bar, what
> you actually see is the local cached copy of that page so you are not
> executing code on the server side. If you try to do anything that may
> trigger a server side event, then you will be redirected to your login
> page.
> If you don´t what your page to be cached locally, you may add this code to
> the page load event:
>
> this.Response.Cache.SetCacheability( HttpCacheability.NoCache );
>
>
> Hernan de Lahitte
> http://weblogs.asp.net/hernandl
>
>
>
> "Zagor" <> escribió en el mensaje
> news:...
>>
>> Hi All, (thanks in advance for your time)
>> I have a standard login.aspx page (UserName\Password). When the user
>> successully sign in they are redirected to a control panel page
>> (admin.aspx), which contains a logout button with this code
>>
>> private void OnLogOutClicked(......)
>> {
>> FormsAuthentication.SignOut();
>> lbStatus.Text= "You have successfully log out";
>> }
>>
>> in this same page on PageLoad I have the below code
>>
>> private void Page_Load(.....)
>> {
>> if ( Request.IsAuthenticated = = true ) {...
>> lbStatus.Text = "User" + User.Identity.Name + "is currenlty logged
>> in";}
>> }
>>
>> The problem is that when the user clicks the "Log Out" button the label
>> status gets updated(fine) and if the user clicks any other buttons(on the
>> page) they will be automatically redirect to the login page (fine), which
>> basically confirm that he\she is logout and no operation can be done on
>> the page.
>> Now if I try to type in, the address manually I will be now able to
>> access the page ( even is no operation can be done) but the label status
>> get updated as logged in , which means that the user is STILL
>> authenticated. How can ensure that if your are logged out , the
>> Request.IsAuthenticated will be false!
>> Please any help willl be appreciated
>>
>> Frank
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57