You are on page 1of 1

namespace Web.Control.Member.

User
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Security;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
using Lx.Web.Common.UI;
using Lx.Web.Common.ControlsUI;
using System.Collections;

using BLF.WWW_User.Users;

public class Logout : BaseControl


{
protected override void OnLoad(EventArgs e)
{
User.Logout(HttpContext.Current.User.Identity.Name);
string cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie = Page.Request.Cookies[cookieName];
int k = cookieName.IndexOf("$");
if (authCookie != null)
{
if (k > 0)
{
authCookie.Domain = cookieName.Substring(k + 1);
}
authCookie.Expires = DateTime.Now.AddDays(-1);
Page.Response.Cookies.Add(authCookie);
}
Session.Abandon();
string url = this.Page.Request.Url.AbsoluteUri;
int pos = url.IndexOf("ReturnUrl=");
if (pos > 0)
{
url = url.Substring(pos + 10);
}
else
{
url = WWWHost;
}
Page.Response.Redirect(url);
//base.OnLoad (e);
}

}
}