protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["ImCrissLoginCookie"] == null) { Response.Redirect("Login.aspx"); } else { EncryUtil eu = new EncryUtil(); if (Request.Cookies["ImCrissLoginCookie"].Values["Login"] != eu.Enc(AppCode.LoginPassword)) { Response.Redirect("Login.aspx"); } } string filePath = Server.MapPath("~/UploadFile/" + Request.QueryString["FilesName"]); //文件在服务器上的相对路径 FileInfo file = new FileInfo(filePath); //实例一个文件信息类 Response.ContentEncoding = Encoding.GetEncoding("UTF-8"); //用UTF-8格式编码,解决中文乱码 Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(file.Name)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(file.FullName); //写入文件 Response.End(); }
public string VisitStr = ""; //访问登录情况 protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["ImCrissLoginCookie"] == null) { Response.Redirect("Login.aspx"); } else { EncryUtil eu = new EncryUtil(); if (Request.Cookies["ImCrissLoginCookie"].Values["Login"] != eu.Enc(AppCode.LoginPassword)) { Response.Redirect("Login.aspx"); } } dal = new SQLite(Server.MapPath("\\Bowtech.db")); if (txtType.Value == "Submit") { } Querys(); QueryBackUp(); QueryRemind(); QueryError(); QueryVisit(); }
public string data = "";//筛选条件用的 protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["ImCrissLoginCookie"] == null) { Response.Redirect("Login.aspx"); } else { EncryUtil eu = new EncryUtil(); if (Request.Cookies["ImCrissLoginCookie"].Values["Login"] != eu.Enc(AppCode.LoginPassword)) { Response.Redirect("Login.aspx"); } } dal = new SQLite(Server.MapPath("\\Bowtech.db")); ((Label)Master.FindControl("lblMasterTitle")).Text = "记忆查询"; SetData(); if (IsSave.Value == "Save") { UpdateContent(SaveID.Value, txtContent.Value); IsSave.Value = ""; txtContent.Value = ""; } }
protected void Page_Load(object sender, EventArgs e) { dal = new SQLite(Server.MapPath("\\Bowtech.db")); if (Request.QueryString["funType"] != null && Request.QueryString["funType"] == "True") { if (Request.QueryString["ID"] != null) { string password = Request.QueryString["ID"]; if (password == AppCode.LoginPassword) { EncryUtil eu = new EncryUtil(); HttpCookie cookie = new HttpCookie("ImCrissLoginCookie"); cookie.Values.Add("Login", eu.Enc(password)); cookie.Expires = DateTime.Now.AddDays(7); Response.Cookies.Add(cookie); Response.Clear(); Response.Buffer = false; Response.Write("True"); Response.Flush(); Response.End(); } else { Response.Clear(); Response.Buffer = false; Response.Write("False"); Response.Flush(); Response.End(); } } } else if (Request.QueryString["funType"] != null && Request.QueryString["funType"] == "VisitCount") { string sql = "Select Count(*) From Visit where VisitDate='" + DateTime.Now.ToString("yyyy-MM-dd") + "'"; if (dal.ExecuteInt(sql) > 0) { sql = "Update Visit Set LastTime='" + DateTime.Now.ToString("HH:mm:ss") + "' ,VisitCount=VisitCount+1 where VisitDate='" + DateTime.Now.ToString("yyyy-MM-dd") + "'"; dal.ExecuteNonQuery(sql); } else //当天第一次.. { sql = "Insert into Visit(VisitDate,LastTime,VisitCount,ComeInCount,ErrorCount) values('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("HH:mm:ss") + "',1,0,0)"; dal.ExecuteNonQuery(sql); } } else if (Request.QueryString["funType"] != null && Request.QueryString["funType"] == "ComeIn") { string sql = "Update Visit Set LastTime='" + DateTime.Now.ToString("HH:mm:ss") + "' ,ComeInCount=ComeInCount+1 where VisitDate='" + DateTime.Now.ToString("yyyy-MM-dd") + "'"; dal.ExecuteNonQuery(sql); } else if (Request.QueryString["funType"] != null && Request.QueryString["funType"] == "Error") { string sql = "Update Visit Set LastTime='" + DateTime.Now.ToString("HH:mm:ss") + "' ,ErrorCount=ErrorCount+1 where VisitDate='" + DateTime.Now.ToString("yyyy-MM-dd") + "'"; dal.ExecuteNonQuery(sql); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["ImCrissLoginCookie"] == null) { Response.Redirect("/Page/Login.aspx"); } else { EncryUtil eu = new EncryUtil(); if (Request.Cookies["ImCrissLoginCookie"].Values["Login"] != eu.Enc(AppCode.LoginPassword)) { Response.Redirect("/Page/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["ImCrissLoginCookie"] == null) { Response.Redirect("Login.aspx"); } else { EncryUtil eu = new EncryUtil(); if (Request.Cookies["ImCrissLoginCookie"].Values["Login"] != eu.Enc(AppCode.LoginPassword)) { Response.Redirect("Login.aspx"); } } ((Label)Master.FindControl("lblMasterTitle")).Text = "编辑网址"; }
// SQLite dal; protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["ImCrissLoginCookie"] == null) { Response.Redirect("Login.aspx"); } else { EncryUtil eu = new EncryUtil(); if (Request.Cookies["ImCrissLoginCookie"].Values["Login"] != eu.Enc(AppCode.LoginPassword)) { Response.Redirect("Login.aspx"); } } // dal = new SQLite(Server.MapPath("\\Bowtech.db")); ((Label)Master.FindControl("lblMasterTitle")).Text = "网址收藏"; }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["ImCrissLoginCookie"] == null) { Response.Redirect("/Page/Login.aspx"); } else { EncryUtil eu = new EncryUtil(); if (Request.Cookies["ImCrissLoginCookie"].Values["Login"] != eu.Enc(AppCode.LoginPassword)) { Response.Redirect("/Page/Login.aspx"); } } dal = new SQLite(Server.MapPath("\\Bowtech.db")); Querys(); }
// EncryUtil eu = new EncryUtil(); protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["ImCrissLoginCookie"] == null) { Response.Redirect("Login.aspx"); } else { EncryUtil eu = new EncryUtil(); if (Request.Cookies["ImCrissLoginCookie"].Values["Login"] != eu.Enc(AppCode.LoginPassword)) { Response.Redirect("Login.aspx"); } } // dal = new SQLite(Server.MapPath("\\Bowtech.db")); ((Label)Master.FindControl("lblMasterTitle")).Text = "数据库查询"; // string ip = dal.ExecuteString("Select ip From Sys_dbs where id='9'"); // string LoginName = dal.ExecuteString("Select LoginName From Sys_dbs where id='9'"); // string Password = dal.ExecuteString("Select Password From Sys_dbs where id='9'"); }
public void ProcessRequest(HttpContext context) { dal = new SQLite(System.Web.HttpContext.Current.Server.MapPath("\\Bowtech.db")); context.Response.ContentType = "text/plain"; if (context.Request.QueryString["funType"] == "GetBase") { string sql = @"select ID,Name from Sys_dbs"; context.Response.Write(ConvertDataTableToJson(dal.ExecuteDataTable(sql))); } else if (context.Request.QueryString["funType"] == "DeleteDataBase") { string sql = @"Delete From Sys_dbs where ID ='" + context.Request.QueryString["ID"] + "'"; context.Response.Write(ConvertDataTableToJson(dal.ExecuteDataTable(sql))); } else if (context.Request.QueryString["funType"] == "SaveDataBase") { EncryUtil eu = new EncryUtil(); string ip = eu.Enc(context.Request.QueryString["ip"]); string LoginName = eu.Enc(context.Request.QueryString["loginName"]); string Password = eu.Enc(context.Request.QueryString["passWord"]); string sql = @"Insert into Sys_dbs(Name,IP,Types,LoginName,Password) values('" + context.Request.QueryString["name"] + "','" + ip + "','SQL Server 身份验证','" + LoginName + "','" + Password + "')"; dal.ExecuteNonQuery(sql); context.Response.Write("OK"); } else if (context.Request.QueryString["funType"] == "GetDisplay") { string sql = " select ID,Name,visble,case visble when 0 then '显示中' else '隐藏中' end as Status,case visble when 0 then '切换至隐藏' else '切换至显示' end as col from Notes where type=0"; context.Response.Write(ConvertDataTableToJson(dal.ExecuteDataTable(sql))); } else if (context.Request.QueryString["funType"] == "Viazble") { string vizble = context.Request.QueryString["visble"] == "0" ? "1" : "0"; string sql = "Update Notes Set Visble=" + vizble + " where ID=" + context.Request.QueryString["ID"]; dal.ExecuteNonQuery(sql); } }
public string VisitStr = ""; //访问登录情况 protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["ImCrissLoginCookie"] == null) { Response.Redirect("Login.aspx"); } else { EncryUtil eu = new EncryUtil(); if (Request.Cookies["ImCrissLoginCookie"].Values["Login"] != eu.Enc(AppCode.LoginPassword)) { Response.Redirect("Login.aspx"); } } dal = new SQLite(Server.MapPath("\\Bowtech.db")); if (txtType.Value == "Submit") { try { string sql = "Update Remind set Notes = '" + txtContent.Value.Filter() + "',EditDate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"; dal.ExecuteNonQuery(sql); txtType.Value = ""; } catch (Exception ep) { ep.Message.Logs(); } } Querys(); QueryBackUp(); QueryRemind(); QueryError(); QueryVisit(); }
public static string GetMD5(this string str, bool lower = true, bool shortMD5 = false) { return(EncryUtil.GetMD5(str, lower, shortMD5)); }