Cookies are a fast place for browsers to store small pieces of data. You can set and read cookies on the server or on the client.
Webform1.aspx page
<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "webform1.aspx. cs" inherits = "webapplication3.webform1" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">
Webform1.cs code
Using system; using system. collections. generic; using system. LINQ; using system. web; using system. web. ui; using system. web. UI. webcontrols; namespace webapplication3 {public partial class webform1: system. web. UI. page {protected void page_load (Object sender, eventargs e) {} protected void button#click (Object sender, eventargs e) {response. setcookie (New httpcookie ("username", textbox1.text); // set cookie on the server} protected void button2_click (Object sender, eventargs e) {textbox2.text = request. cookies ["username"]. value; // obtain the cookie on the server }}}