user wrote:
Hi everyone,
May I know the standard way of reading in cookies in ASP.net using
VB.net?
In classic asp, i can do this:
If request.cookies("user") = "abc" then
blah blah
end if
But if i were to do the same in asp.net,
I would hit an ugly error.
What is the proper way of detecting cookies?
Thanks
The difference in .NET is that what you get from the Request.Cookies
collection is an HttpCookie object instead of a string. If the cookie
doesn't exist, you get a null reference instead of an empty string.
HttpCookie user = Request.Cookies("user");
if (user != null && user.Value == "abc") {
//blah blah
}
--
Göran Andersson
_____
http://www.guffa.com