adding/setting a cookie vb.net

ngphuc2k

New Member
I know how to add / set cookies in VB.Net , usually I check if it is null ( or Nothing in VB) if it is nothing I set a new cookie , if it is not then I set the value of the previous cookie. My question is there any thing wrong , or any down side to just adding a cookie every time like this:\[code\]HttpContext.Current.Response.Cookies.Add(New HttpCookie("Lat", dt(0)(1).ToString().Trim()))\[/code\]I'm hoping that this will just override the previous Cookie("Lat") if it exists , and set a new one if it doesn't , if this works it will really make my code a lot shorter and make things easier. I don't see why this wouldn't work - but every tutorial and example online normally checks if it exists first.
 
Back
Top