Beispiel #1
0
        protected void imgbtnLogin_Click(object sender, ImageClickEventArgs e)
        {
            string l_strUserName = txtUserName.Text;

            //登陆
            OALogin.LoginUserInfo info = OALogin.Login(l_strUserName);

            if (info.ID == -1)
            {
                IMessage im = new WebFormMessage(Page, "没有该用户");
                im.Show();
                return;
            }

            if (info.Domain == "")
            {
                IMessage im = new WebFormMessage(Page, "OA子系统用户必须为域用户");
                im.Show();
                return;
            }

            HttpCookie cookie = new HttpCookie("NewOA");

            TimeSpan ts = new TimeSpan(365, 0, 0, 0);

            cookie.Expires = DateTime.Now.Add(ts);
            cookie.Values.Remove("LoginID");
            cookie.Values.Add("LoginID", l_strUserName);
            this.Response.AppendCookie(cookie);

            Session["LoginUserInfo"] = info;


            Response.Redirect("~/Index.aspx", true);
        }
Beispiel #2
0
        private void Login(string strUserName, string AuID)
        {
            OALogin.LoginUserInfo info = OALogin.Login(strUserName);

            Session["LoginUserInfo"] = info;

            HttpCookie cookie = new HttpCookie("NewOA");

            TimeSpan ts = new TimeSpan(365, 0, 0, 0);

            cookie.Expires = DateTime.Now.Add(ts);
            cookie.Values.Remove("LoginID");
            cookie.Values.Add("LoginID", strUserName);
            HttpContext.Current.Response.AppendCookie(cookie);
        }