/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaves_Click(object sender, EventArgs e) { try { string[] filePath = ConfigurationManager.AppSettings["filePath"].Split('|'); if (filePath[0] != "null" && filePath[1] != "nameNull") { string destFilePath = Server.MapPath(@"image\Head") + "\\" + filePath[1]; if (File.Exists(filePath[0])) { if (File.Exists(destFilePath)) { File.Delete(destFilePath); } File.Copy(filePath[0], destFilePath); File.Delete(filePath[0]); if (Session["loginUserName"] != null) { UserTable_BLL bll = new UserTable_BLL(); User_Table user = Session["loginUserName"] as User_Table; user.U_Head = filePath[1]; ConfigurationManager.AppSettings["defaultHead"] = filePath[1]; Session["loginUserName"] = user; int n = bll.Update_UserTableData(user); } } } } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('操作异常:" + ex.Message + "');", true); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; User_Table user = userbll.GetUserTableByConn(context.Request["loginName"], "name"); user.U_Phone = context.Request["newPhone"]; int n = userbll.Update_UserTableData(user); if (n > 0) { context.Response.Write("1"); } else { context.Response.Write("0"); } }