Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 24th, 2005, 08:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default Signout Not Working

I am trying to use FormsAuthentication on my site. I have stup my SQl database and my web config and global files and I have it working...the only problem is, I cannot log out. In my logout routine I have:

FormsAuthentication.SignOut

which doesn't work when I try anything like : User.Identity.Name I get results.

I also tried adding:

Context.Response.Cookies.Item(FormsAuthentication. FormsCookieName).Expires = Date.Now

to my log out routine but that doesnt work either...the only thing that seems to work to log out the user is closing the browser...



-------------------------
Beware of programmers with screwdrivers...
__________________
-------------------------
Beware of programmers with screwdrivers...
  #2 (permalink)  
Old October 24th, 2005, 01:07 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Do you redirect after your call to SignOut??

And what does IsAuthenticated return?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #3 (permalink)  
Old October 24th, 2005, 01:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default

Yes, I do redirect:
Code:
Private Sub btnLogout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogout.Click
    FormsAuthentication.SignOut
    Context.Response.Cookies.Item(FormsAuthentication.FormsCookieName).Expires = Date.Now.AddDays(-1)
    Response.Redirect("/home.htm")
End Sub
IsAuthenticated returns TRUE


-------------------------
Beware of programmers with screwdrivers...
  #4 (permalink)  
Old October 24th, 2005, 01:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default

I think I found my problem...in my web.config I had:

Code:
<forms 
            loginUrl="Login.aspx" 
            name="sqlAuthCookie" 
            timeout="60" path="/sitename"
            protection="All"></forms>


I removed the path and it works now


-------------------------
Beware of programmers with screwdrivers...
  #5 (permalink)  
Old October 25th, 2005, 02:35 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Great. BTW, there is no need to manually kill the cookie; the SignOut call will do that for you...

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #6 (permalink)  
Old July 12th, 2006, 08:35 AM
Registered User
 
Join Date: Jul 2006
Location: São Paulo, SP, Brazil.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey ~Bean~, you've got it! I had the exactly same issue and your hint have solved it! Thanks!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fail to signout completely SpringSummer ASP.NET 1.0 and 1.1 Basics 2 April 11th, 2007 11:01 AM
Signout Prolem hunzian78@yahoo.com ASP.NET 1.0 and 1.1 Basics 4 April 5th, 2006 01:59 AM
Problem with ASP.NET "signout" sharj ASP.NET 1.0 and 1.1 Professional 3 January 23rd, 2006 03:10 AM
SignOut is broken? cohansh1 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 June 21st, 2005 01:09 AM
the err of SignOut allanhu BOOK: ASP.NET Website Programming Problem-Design-Solution 3 May 3rd, 2005 09:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.