How to retrieve from cookie in c#?

Forums .NETHow to retrieve from cookie in c#?
Staff asked 1 month ago

Answers (1)

Add Answer
Staff answered 1 month ago

Extract information from a cookie

Using the Request object, it is simple to obtain cookie values from cookies.


string User_name = string.Empty;  
string User_Id = string.Empty;  
HttpCookie reqCookies = Request.Cookies["userInfo"];  
if (reqCookies != null)  
    User_name = reqCookies["UserName"].ToString();  
    User_Id = reqCookies["UserID"].ToString();  



Select Categories