Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I try to set my cookie up to my website but when I write Http Cookie into the code,

my code looks like this:

C#
HttpCookie StudentCookies = new HttpCookie("StudentCookies");
StudentCookies.Value = 1;
Response.Cookies.Add(StudentCookies);


error are:

The type or namespace name 'HttpCookie' could not be found (are you missing a using directive or an assembly reference?) TestMVCLagerSystem.DNX 4.5.1

'Response' does not contain a definition for 'Cookies' TestMVCLagerSystem.DNX 4.5.1

i have try to looke here:

http://stackoverflow.com/questions/19128507/using-cookie-in-asp-net-mvc-4[^]
Posted
Comments
Richard Deeming 28-Oct-15 13:44pm    
Sounds like you're missing a using directive or assembly reference.

HttpCookie is defined in the System.Web namespace, in the System.Web assembly.
Sreekanth Mothukuru 28-Oct-15 15:20pm    
Try this
HttpContext.Current.Request.Cookie or
HttpContext.Current.Response.Cookie

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900