Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem using login control when site has both authenticated an unauthenticated users

Reply
Thread Tools

Problem using login control when site has both authenticated an unauthenticated users

 
 
Keithb
Guest
Posts: n/a
 
      10-28-2006
I am using the login control on my web site, which has both authenticated an
unauthenticated users. I added a logout page that is supposed to allow an
authenticated user to drop his authentication and resume operation as an
unauthenticated user. Using the below code in my logout page, the user is
taken directly to the login page immediately after logging out and has no
way of returning to the home page as an unauthenticated user.

protected void LinkButton1_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
}

As a workaround, I changed the web.config file to show the loginUrl as
Default.aspx instead of login_page.aspx, as shown below:

<forms name="Enterprise Integration Interfaces : Login"
loginUrl="Default.aspx" path="/" protection="All" timeout="60"></forms>

I also added FormsAuthentication.RedirectToLoginPage(); to the linkbutton
event hander on the logout page as shown below:

protected void LinkButton1_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}

The workaround does solve the problem, however, it seems like a Kludge to
me, and I have the feeling that there is a 'proper' way to do this.

Can someone suggest a more elegant solution?

Thanks,

Keith


 
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
Protecting unauthenticated users from downloading .swf files Klaus Jensen ASP .Net 1 06-19-2008 10:37 PM
redirect unauthenticated users from frameset child pages? =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?= ASP .Net 3 11-02-2005 06:22 PM
How to Synchronize anonymous users with authenticated users using profiles? Rodusa ASP .Net 2 09-08-2005 08:12 PM
Prevent a page in an authenticated application from being authenticated Abhijit ASP General 0 04-12-2004 02:10 PM
Specifying all files except Login.aspx and Join.aspx are restricted to authenticated users SamIAm ASP .Net 1 12-04-2003 02:59 PM



Advertisments