When a web server creates a cookie, an additional HTTP header is sent to the browser when a page is served to the browser. The HTTP header looks like this:
Set-Cookie: message=Hello
After a cookie has been created on a browser, whenever the browser requests a page from the same application in the future, the browser sends a header that looks like this:
Cookie: message=Hello
There two type of cookies in ASP.NET
Persistent cookies:  cookies are stored on your computer hard disk.  They stay on your hard disk and can be accessed by web servers until they are deleted or have expired. A session cookie exists only in memory. A persistent cookie can last for months or even years. A persistent cookie is stored permanently by the users browser on the users computer.
public void SetPersistentCookies(string name, string value){
 HttpCookie cookie = new HttpCookie(name);
 cookie.Value = value;
 cookie.Expires = Convert.ToDateTime(“12/1/2016”);
 Response.Cookies.Add(cookie);}

Non-persistent cookies: cookies are saved only while your web browser is running.  They can be used by a web server only until you close your browser.  They are not saved on your disk.
Note: You can store only string values when using a cookie.

You can use Visual Studio to work faster and more efficiently when you write, navigate, and debug your code. There are some tricks which is helpful to every programmer-

This example illustrate how to count and show remaining characters in TextBox using JavaScript in Asp.Net.Create a new website in Visual Studio and place one TextBox and Label on the default.aspx page in design mode.Go to HTML source of page and write a JavaScript function named Count in head section of page to count remaining characters in TextBox.Set the MaxLength property of TextBox to 10 chars.

PreviousDisplaying 7 of 7
1 2 3 4 5 6 7
Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*