Hey everybody. The program that i'm writing makes use of cookies to track logins. When I run it from my machine (the "server") as the cookies save fine. When I try to run it from another machine, or even mine by going to the cookies no longer work and I get a "Object reference not set to an instance of an object" error. Here's what my code looks like:
'Now we make a small cookie to track the user.
Dim loginCookie As New HttpCookie("Login")
loginCookie.Values.Add("LoggedIn", "TRUE")
loginCookie.Values.Add("StoreID", storeID)
loginCookie.Values.Add("UserType", userType)
loginCookie.Domain = "my_computer"
Response.AppendCookie(loginCookie)
'Read the cookie
Dim loginCookie As New HttpCookie("Login")
loginCookie = Request.Cookies("Login")
Response.Write(loginCookie("LoggedIn") & "<BR>")
Response.Write(loginCookie("StoreID") & "<BR>")
Response.Write(loginCookie("UserType"))
The second line of the "read the cookie" is what throws the exception. I know there's no error checking on this, I'm just trying to get it running. Any help would be greatly appreciated!
Jeff Rapp
jrapp@sell2all.com
'Now we make a small cookie to track the user.
Dim loginCookie As New HttpCookie("Login")
loginCookie.Values.Add("LoggedIn", "TRUE")
loginCookie.Values.Add("StoreID", storeID)
loginCookie.Values.Add("UserType", userType)
loginCookie.Domain = "my_computer"
Response.AppendCookie(loginCookie)
'Read the cookie
Dim loginCookie As New HttpCookie("Login")
loginCookie = Request.Cookies("Login")
Response.Write(loginCookie("LoggedIn") & "<BR>")
Response.Write(loginCookie("StoreID") & "<BR>")
Response.Write(loginCookie("UserType"))
The second line of the "read the cookie" is what throws the exception. I know there's no error checking on this, I'm just trying to get it running. Any help would be greatly appreciated!
Jeff Rapp
jrapp@sell2all.com