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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0SignOut problem while using Forms authentication.SignOut problem while using Forms authentication.
Previous
 
Next
New Post
2/12/2008 3:09 AM
 

Hi,

We are using formsAuthentication in our project.so while clicking on logout button

we have given "Forms.authentication.signout" in the buttonclickevent.But it is not  loging out.

can anyone please help regarding this.

Thanks&Regards,

V.Vinil Bradesh

 

 
New Post
2/12/2008 4:36 PM
 

It needs a few more things to kill in order to sign the user out... check out this sample method:

public static void SignoutUser(System.Web.HttpContext httpContext, DotNetNuke.Entities.Portals.PortalSettings ps)
  {
   // sign them out

   // Log User Off from Cookie Authentication System
   System.Web.Security.FormsAuthentication.SignOut();

   //remove language cookie
   httpContext.Response.Cookies["language"].Value = "";

   // expire cookies
   if (DotNetNuke.Security.PortalSecurity.IsInRoles(ps.AdministratorRoleId.ToString()) && httpContext.Request.Cookies["_Tab_Admin_Content" + ps.PortalId.ToString()] != null)
   {
    httpContext.Response.Cookies["_Tab_Admin_Content" + ps.PortalId.ToString()].Value = null;
    httpContext.Response.Cookies["_Tab_Admin_Content" + ps.PortalId.ToString()].Path = "/";
    httpContext.Response.Cookies["_Tab_Admin_Content" + ps.PortalId.ToString()].Expires = DateTime.Now.AddYears(-30);
   }

   httpContext.Response.Cookies["portalaliasid"].Value = null;
   httpContext.Response.Cookies["portalaliasid"].Path = "/";
   httpContext.Response.Cookies["portalaliasid"].Expires = DateTime.Now.AddYears(-30);

   httpContext.Response.Cookies["portalroles"].Value = null;
   httpContext.Response.Cookies["portalroles"].Path = "/";
   httpContext.Response.Cookies["portalroles"].Expires = DateTime.Now.AddYears(-30);

   if (httpContext.Request.Cookies["_Tab_Admin_Preview" + ps.PortalId.ToString()] != null)
   {
    httpContext.Response.Cookies["_Tab_Admin_Preview" + ps.PortalId.ToString()].Value = "False";
   }
  }


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
2/13/2008 7:22 AM
 

Hey vinil

Use logoff.aspx page provided by dotnetnuke to logout your user as its the best way to deal with it.

you can find that page in Website root/admin/security/logoff.aspx

Hope this helps


Find out code snippets, tutorials and How Tos' about dotnetnuke at lakhlaniprashant.blogspot.com Umlimited wedding planning tips, free wedding websites and more at http://www.FirstPhera.com an indian dotnetnuke portal dedicated to wedding planning!
 
New Post
10/29/2009 2:00 PM
 

I know this is an old post, but I wanted to document wherever this code exists that there is a better way of clearing the user's roles cookie, with is with the PortalRoles.ClearRoles() shared/static method. That encapsulates the three lines that otherwise modify the portalroles cookie above.

Using the API is always a better way to work with the system if possible because it allows for changes to be made to the internal workings. I'm currently working on a resolution for the limit on the number of roles in which a user exists prior to the system falling over because of truncation of data (causing a decryption exception) in the user's roles cookie.

Whilst the code here won't affect what I'm doing, I thought I'd post the API method of doing the same thing. I'm just trying to do my bit for interoperability throughout the community!

To summarise,

<code>
PortalSecurity.ClearRoles()
</code>

replaces

<code>
Response.Cookies["portalroles"].Value = Nothing;
Response.Cookies["portalroles"].Path = "/";
Response.Cookies["portalroles"].Expires = DateTime.Now.AddYears(-30);
</code>
 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0SignOut problem while using Forms authentication.SignOut problem while using Forms authentication.


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