Reputation: 25
Trying to start with VB.Net and having problem
We have such a Class in C#. How to check if cookie exist? Exactly, how to set input object "Cookie" for a function CookieExist? How to create it using GeckoFx? For example, how to find cookie with the name "Test2"?
Please, make an example.
I'm going crazy with VB.Net
P.S. I rarely write to forums if can find info on my own but VB.Net have too few examples in the net. ;/
Upvotes: 0
Views: 3493
Reputation: 366
I think the code below will help you:
Dim cookieValue As String = "Value of cookie"
Dim cookieName As String = "CookieName"
Dim realCookie As HttpCookie = HttpContext.Current.Request.Cookies.Get(cookieName)
If IsNothing(realCookie) Then
HttpContext.Current.Request.Cookies.Add(New HttpCookie(cookieName, cookieValue))
End If
Upvotes: 3