Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...How to force a complete logout in code?How to force a complete logout in code?
Previous
 
Next
New Post
10/5/2009 10:55 AM
 

If I'm logged into my Portal and then login as a different user, everything (the menu and page security) behaves as though I was still the previous user.  If I wait a while, it will eventually show up correctly, but that sucks.

What I'd like to do is, on logon, make certain that there's nothing residual left over from the previously logged in user.  How do I do this?  I can't find a "Logout" method anywhere in the Security namespace and I don't know where else to look.

 

thanks.....

 
New Post
10/5/2009 11:24 AM
 

The DotNetNuke.Security.PortalSecurity class has a SignOut method.  Also, the Logoff control calls DotNetNuke.Common.Utilities.DataCache.ClearUserCache.

However, the behavior that you're seeing definitely shouldn't be something that you have to manage.  Are you logging out using the standard logout skin object?  Are you using the standard authentication system?  Is there anything that you're changed (maybe caching settings) that might interfere with the regular behavior?

Hope it helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
10/5/2009 12:07 PM
 

 Brian, thanks for the reply.

I am not using the included Logout token; I have a custom login page with custom controls, so I'm trying to recreate the Logout process as well.

I've tried the "ClearUserCache" method, but that doesn't seem to work... Do you happen to know exactly which method to call from the PortalSecurity class?  "ClearRoles()" is the only thing I see that looks relevant to logging out, but I don't want to call it w/o knowing what it does first. :)

 

Thanks!

 

 
New Post
10/5/2009 12:49 PM
 

Please install this module:

Terms and Conditions Module

And let me know if it logs you out correctly. It uses this code:

        protected void btnDecline_Click(object sender, EventArgs e)
        {
            // Logout user
            PortalSecurity objPortalSecurity = new PortalSecurity();
            objPortalSecurity.SignOut();

            // Redirect the user to the current page
            Response.Redirect(Globals.NavigateURL());
        }
 

notice it redirects you after log out. Without this, you would still be "logged in"



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
10/5/2009 1:46 PM
 

 thank you both!

this might be overkill, but it looks like this is working now... I run the following every time the Login page is generated:

        DotNetNuke.Security.PortalSecurity.ClearRoles();

        Session.Clear();

        Session.Abandon();

        PortalSecurity objPS = new PortalSecurity();

        objPS.SignOut();

 

Thanks again!

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...How to force a complete logout in code?How to force a complete logout in code?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out