C# 之 Cookie 接收方法

撰寫 Cookie (Visual C#)



client端建立cookie

HttpCookie myCookie = new HttpCookie("MyTestCookie");
// Set the cookie value.
myCookie.Value = 放你想要的數值;
DateTime now = DateTime.Now;
myCookie.Expires = now.AddMinutes(1);   <--- ookie="" p="">// Add the cookie.
Response.Cookies.Add(myCookie);      <----client cookie="" p="">
------------------------------------------------------------------------------------------------------------------
Server接收cookie


HttpCookie myCookie = new HttpCookie("MyTestCookie");
myCookie = Request.Cookies["MyTestCookie"];
// Read the cookie information and display it.
string result = myCookie.Value;  <--- p="">

留言

這個網誌中的熱門文章

數位信封 Digital Envelope

SSL的運作原理