示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request.QueryString["clientid"] != null && Request.QueryString["clientid"] != "") || (Request.QueryString["client"] != null && Request.QueryString["client"] != ""))
        {
            if (Request.QueryString["clientid"] != null && Request.QueryString["clientid"] != "")
            {
                Response.Cookies["clientidCookie"].Value   = System.Web.HttpContext.Current.Request.QueryString["clientid"].ToString();
                Response.Cookies["clientidCookie"].Expires = DateTime.Now.AddDays(30);

                Session["client"]            = ClientConfig.ConfigurationsId(HttpContext.Current.Request.QueryString["clientid"].ToString(), "slug");
                Session["clientid"]          = System.Web.HttpContext.Current.Request.QueryString["clientid"].ToString();
                Session["configTheme"]       = ClientConfig.ConfigurationsId(HttpContext.Current.Request.QueryString["clientid"].ToString(), "configTheme");
                Session["configCompanyName"] = ClientConfig.ConfigurationsId(HttpContext.Current.Request.QueryString["clientid"].ToString(), "configCompanyName");
                Session["ConnectionString"]  = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());

                Response.Cookies["clientid"].Value   = System.Web.HttpContext.Current.Session["clientid"].ToString();
                Response.Cookies["clientid"].Expires = DateTime.Now.AddDays(30);
            }
            else if (Request.QueryString["client"] != null && Request.QueryString["client"] != "")
            {
                Response.Cookies["clientCookie"].Value   = System.Web.HttpContext.Current.Request.QueryString["client"].ToString();
                Response.Cookies["clientCookie"].Expires = DateTime.Now.AddDays(30);

                Session["client"]            = System.Web.HttpContext.Current.Request.QueryString["client"].ToString();
                Session["clientid"]          = ClientConfig.ConfigurationsSlug(HttpContext.Current.Request.QueryString["client"].ToString(), "clientid");
                Session["configTheme"]       = ClientConfig.ConfigurationsSlug(HttpContext.Current.Session["client"].ToString(), "configTheme");
                Session["configCompanyName"] = ClientConfig.ConfigurationsSlug(HttpContext.Current.Session["client"].ToString(), "configCompanyName");
                Session["ConnectionString"]  = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());

                Response.Cookies["clientidCookie"].Value   = System.Web.HttpContext.Current.Session["clientid"].ToString();
                Response.Cookies["clientidCookie"].Expires = DateTime.Now.AddDays(30);
            }
        }
        else
        {
            if (Request.Cookies["clientidCookie"] != null)
            {
                Response.Redirect("login.aspx?clientid=" + Request.Cookies["clientidCookie"].Value.ToString());
            }
            else if (Session["clientid"] == null || Session["clientid"].ToString() == "")
            {
                Response.Redirect("err_default.htm");
            }
        }

        connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
        //connstring = ConfigurationManager.ConnectionStrings["EBidConnectionString"].ConnectionString;
        //Response.Write(connstring + ":" + ConfigurationManager.ConnectionStrings["EBidConnectionString"].ConnectionString);
        if (connstring == "Data Source=COMPSERVER;Initial Catalog=ebid;User ID=sa;Password=Sqldbo@2012")
        {
            Response.Redirect("err_default.htm");
        }

        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(User.Identity.Name))
            {
                FormsAuthenticationHelper.SignOut();
            }
        }

        if (Request.QueryString["t"] != null)
        {
            if (Request.QueryString["t"] != "")
            {
                int i = int.Parse(Request.QueryString["t"]);
                mView.ActiveViewIndex = i < mView.Views.Count ? i : 0;

                if ((IsPostBack) && (i == 1))
                {
                    btnSend_Click(null, null);
                }
            }
            else
            {
                mView.ActiveViewIndex = 0;
            }
        }
        else
        {
            mView.ActiveViewIndex = 0;
        }

        if (!IsPostBack)
        {
            if (Session["msg"] != null)
            {
                txtNote2.Text  = Session["msg"].ToString();
                Session["msg"] = null;
            }
        }
    }