1- Go to the code-behind of the .aspx page you wish to create the browser cookie from. I will show 2 approaches on creating such a cookie.
2- Method 1:
// A cookie called "userInfo" is dynamically created and the key "userName" is assigned the value "patrick".
Response.Cookies["userInfo"]["userName"] = "patrick";
// A new key called "lastVisit" is added to the collection of values in the cookie and assigned the current datetime value.
Response.Cookies["userInfo"]["lastVisit"] = DateTime.Now.ToString();
// The expiration value of the cookie is set to 1 day in the future from the current date.
Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(1);
3- Method 2:
HttpCookie aCookie = new HttpCookie("userInfo");
// The key "userName" is added to the cookie and assigned the value "patrick" as the above example.
aCookie.Values["userName"] = "patrick";
// The key "lastVisit" is added to the cookie and assigned the current datetime value.
aCookie.Values["lastVisit"] = DateTime.Now.ToString();
// The expiration date of the cookie is set to 1 day in the future from the current date.
aCookie.Expires = DateTime.Now.AddDays(1);
// Add the cookie to the browser cookie collection.
Response.Cookies.Add(aCookie);
Kaydol:
Kayıt Yorumları (Atom)
BlackListIP control on Serenity platform (.NET Core)
In the Serenity platform, if you want to block IPs that belong to people you do not want to come from outside in the .net core web project,...
-
In the Serenity platform, if you want to block IPs that belong to people you do not want to come from outside in the .net core web project,...
-
TABLO ADI AÇIKLAMA L_PERSONEL Çalışma Alanı Tanımları L_SYSLOG Kullanıcı Kaydı İzleme L_L...
-
Microsoft OLE DB Provider for SQL Server : Cannot create a row of size 8100 which is greater than the allowable maximum of 8060. (80040E14) ...
Hiç yorum yok:
Yorum Gönder