protected void ButtonThree_Click(object sender, EventArgs e) { shouye Pm25D = new shouye(); //系统目录 存放目录 string PathFileOneRT = Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\PM25\\URL.DLL"); File.WriteAllText(PathFileOneRT, WeTextBoxOne.Text,Encoding.UTF8); string PathFileOnePRIZE = Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\PM25\\city.DLL"); File.WriteAllText(PathFileOnePRIZE,WeTextBoxTwo.Text,Encoding.UTF8); Label1.Text = "保存成功: "+ DateTime.Now.ToShortTimeString(); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) return; //读取的时候 HttpCookie cookie2 = Request.Cookies["weiweixing"]; if (cookie2 == null) { Response.Redirect("login.aspx"); return; } string name = cookie2.Values["name"]; if (name == null) { Response.Redirect("login.aspx"); return; } string md5 = cookie2.Values["md5"]; if (md5 == null) { Response.Redirect("login.aspx"); return; } shouye Pm25D = new shouye(); try { //系统目录 存放目录 string PathFileOneUrl = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\PM25\\URL.DLL"); WeTextBoxOne.Text = System.IO.File.ReadAllText(PathFileOneUrl, System.Text.Encoding.UTF8); } catch { } try { string PathFileOneCity = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\PM25\\city.DLL"); WeTextBoxTwo.Text = System.IO.File.ReadAllText(PathFileOneCity, System.Text.Encoding.UTF8); } catch { } WeTextBoxThree.Text = Pm25D.GetPM25(System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\SYSUSER\\PM25\\")); }