Guest User

Untitled

a guest
Aug 31st, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. how to use session/cookie in website written in C# ( Visual Studio 2010)
  2. public static bool EditUserInfo(string strCookieName, string password)
  3. {
  4. string query = "UPDATE usertb SET password = '" + password + "' WHERE username = '" + Name + "'";
  5. accessDB dbaccess = new accessDB();
  6. return dbaccess.saveData(query);
  7.  
  8. }
  9.  
  10. string id = Session["mysession"].ToString(); //GET
  11. Session["mysession"] = "Hello World"; //SET
  12.  
  13. HttpContext.Current.Request.Cookies["RememberLoginName"].Value //GET
  14. HttpContext.Current.Response.Cookies.Add(new HttpCookie("RememberLoginName", ValueforCookie)); //SET`
Add Comment
Please, Sign In to add comment