Jon F
Jon F

Reputation: 61

Reading cookie from Chrome

I'm using Visual Studio 2015, coding in C# and I'm trying to read a cookie from Chrome.

I have found the HttpCookie class and have added the statement

"using System.Web;"

in the top of the document, but Visual Studio still doesn't seem to recognize this, so I'm not able to use the classes in the System.Web-namespace.

I'm quite sure there is an easy fix for this, but this kind of problem seems to haunt me :-(

Upvotes: 1

Views: 3396

Answers (2)

Andrew Orlov
Andrew Orlov

Reputation: 512

Maybe this can help you? And, yes, System.Web is required when you want to use HttpContext.

var cookie = HttpContext.Current.Request.Cookies["name_of_cookie"];

Upvotes: 0

Zac Braddy
Zac Braddy

Reputation: 611

If I may ask a silly question that I would have left as a comment if I had the priledges, sorry if this isn't your answer. Have you got a reference to the System.Web.dll in your project?

Upvotes: 1

Related Questions