How to retrieve from cookie in c#?

Forums .NETHow to retrieve from cookie in c#?
Staff asked 2 years ago

Answers (1)

Add Answer
Staff answered 2 years 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();  
}  


 

Subscribe

Select Categories