using System;

public partial class LoginOut : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["loginID"] = null;

        string Url =Request.Url.AbsoluteUri.ToLower();//获取URL(包含后面的网页) http://leebtest.gkee.cn/Default.aspx
        string userUrl = "";
        //判断URL是否为空
        if (Url != "")
        {
            string at = Url.Replace("http://", "");       //将URL中的"http://"去掉 leebtest.gkee.cn/Default.aspx
            userUrl = at; //leebtest.gkee.cn/Default.aspx
            userUrl = userUrl.Split('.')[0];   //取字符串第一个点之前的部分 leebtest,二级域名，boss用户名
        }
        if (userUrl != "")
        {
            string Existence = CRM.Common.InitData.CheckBossNameExistence(userUrl);
            if (Existence == "1")
            { //存在二级域名
                string targetUrl = "<script language=javascript>window.top.location.href ='/Default.aspx';</script>";
                Response.Write(targetUrl);
            }
            else
            {
                string targetUrl = "<script language=javascript>top.location.href ='/';</script>";
                Response.Write(targetUrl);
            }
        }
        else
        {
            string targetUrl = "<script language=javascript>top.location.href ='/';</script>";
            Response.Write(targetUrl);
        }
    }
}
