How to create a cookie in C#?

Forums .NETHow to create a cookie in C#?
Staff asked 2 years ago

Answers (1)

Add Answer
Umang Ramani Marked As Accepted
Staff answered 2 years ago

It is quite simple to create a cookie in Asp.Net using the Response object or HttpCookie.

Make a cookie

 

HttpCookie userInfo = new HttpCookie("Test");  
userInfo["UserName"] = "TheCodeHubs";  
userInfo["UserID"] = "1001"; 

Response.Cookies.Add(userInfo);

Subscribe

Select Categories