Esempio n. 1
0
        protected bool GetAccountCookie()
        {
            string acct = Cookie.Load(Request, "mySiteAccount");

            if ("adminy".Equals(acct))
            {
                return(true);
            }
            if (!acct.Equals(""))
            {
                Account = new KeyClueAccount(acct);
                if (!Account.Valid)
                {
                    Account = null;
                    return(false);
                }
                string pwd = Cookie.Load(Request, "mySiteAccountPassword");
                if (!pwd.Equals(Account.Password))
                {
                    Account = null;
                    return(false);
                }
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        protected override void finishPageLoad()
        {
            base.finishPageLoad();

            string username = Cookie.Load(Request, "mySiteAccount");

            if (!"adminy".Equals(username))
            {
                logOut();
                return;
            }

            var acct = new KeyClueAccount("Zoo");

            TextBox1.Text = acct.Stage.ToString();

            acct          = new KeyClueAccount("Geo");
            TextBox2.Text = acct.Stage.ToString();

            acct          = new KeyClueAccount("Mech");
            TextBox3.Text = acct.Stage.ToString();

            acct          = new KeyClueAccount("Chem");
            TextBox4.Text = acct.Stage.ToString();

            acct          = new KeyClueAccount("Civil");
            TextBox5.Text = acct.Stage.ToString();
        }
Esempio n. 3
0
        protected override void finishPageLoad()
        {
            base.finishPageLoad();

            Label1.Text = Cookie.Load(Request, "mySiteAccount");
        }
Esempio n. 4
0
        protected override void finishPageLoad()
        {
            base.finishPageLoad();

            Label1.Text = Cookie.Load(Request, "mySiteAccount");

            string username = Label1.Text;
            var    acct     = new KeyClueAccount(username);

            if (acct.BStage == 1)
            {
                Label2.Visible      = false;
                LinkButton1.Visible = false;
            }

            string strReq = Request.QueryString["file"];

            if ("20130108.zip".Equals(strReq))
            {
                string path = "E:\\KeyClueFiles\\";
                switch (acct.Stage)
                {
                default:
                case 0: path += "stage0"; break;

                case 1: path += "stage1"; break;

                case 2: path += "stage2"; break;

                case 3: path += "stage3"; break;
                }
                path += "\\20130108.zip";
                //path = Server.MapPath(path);
                var f = new System.IO.FileInfo(path);
                if (f.Exists)
                {
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment; filename=20130108.zip");
                    Response.AddHeader("Content-Length", f.Length.ToString());
                    Response.ContentType = "application/octet-stream";
                    Response.WriteFile(f.FullName);
                    Response.End();
                }
                else
                {
                    Response.Write("This file does not exist.");
                }
            }
            else if (acct.BStage == 0 && "20130103.zip".Equals(strReq))
            {
                string path = "E:\\KeyClueFiles\\dummy\\20130103.zip";
                var    f    = new System.IO.FileInfo(path);
                if (f.Exists)
                {
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + strReq);
                    Response.AddHeader("Content-Length", f.Length.ToString());
                    Response.ContentType = "application/octet-stream";
                    Response.WriteFile(f.FullName);
                    Response.End();
                }
                else
                {
                    Response.Write("This file does not exist.");
                }
            }
            else if (strReq != null && !"".Equals(strReq))
            {
                string path = "E:\\KeyClueFiles\\dummy\\dummy.zip";
                var    f    = new System.IO.FileInfo(path);
                if (f.Exists)
                {
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + strReq);
                    Response.AddHeader("Content-Length", f.Length.ToString());
                    Response.ContentType = "application/octet-stream";
                    Response.WriteFile(f.FullName);
                    Response.End();
                }
                else
                {
                    Response.Write("This file does not exist.");
                }
            }
        }