Site Search:
Sign in | Join | Help
4Penny.net

ASP.NET

Notes, Tricks and Tips on ASP.NET Coding

Setting a Cookie

Setting a cookie: 

            'save the new db to a cookie
            Dim newCookie As HttpCookie = New HttpCookie("intranet")
            newCookie("database") = strDatabase
            newCookie.Expires = Now.AddDays(10)
            Response.Cookies.Add(newCookie)

 Reading the cookie:

        'retrieve the database from a cookie
        If Not Request.Cookies("intranet") Is Nothing Then
            Session("database") = Request.Cookies("intranet")("database")
        Else
            Session("database") = "NGB01"
        End If

 

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.