网站 Cookie only 唯一 防止被截获
生活随笔
收集整理的這篇文章主要介紹了
网站 Cookie only 唯一 防止被截获
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
void Page_Load(object sender, EventArgs e)
{
// Create a new HttpCookie.
HttpCookie myHttpCookie = new HttpCookie("LastVisit", DateTime.Now.ToString()); // By default, the HttpOnly property is set to false
// unless specified otherwise in configuration. myHttpCookie.Name = "MyHttpCookie";
Response.AppendCookie(myHttpCookie); // Show the name of the cookie.
Response.Write(myHttpCookie.Name); // Create an HttpOnly cookie.
HttpCookie myHttpOnlyCookie = new HttpCookie("LastVisit", DateTime.Now.ToString()); // Setting the HttpOnly value to true, makes
// this cookie accessible only to ASP.NET.
myHttpOnlyCookie.HttpOnly = true;
myHttpOnlyCookie.Name = "MyHttpOnlyCookie";
Response.AppendCookie(myHttpOnlyCookie); // Show the name of the HttpOnly cookie.
Response.Write(myHttpOnlyCookie.Name);
}
總結
以上是生活随笔為你收集整理的网站 Cookie only 唯一 防止被截获的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 仅6秒完成众筹!3.0T坦克300能继续
- 下一篇: 不论在哪种政治体制下,执政党都很注重稳定