Share cookie values across sub domains

Posted on 2014-08-25
Last Modified: 2014-08-25
Hi Experts -

I have three sites that are all on the same domain, but with different sub domains.

Within the I create a cookie...

Dim aCookie As New HttpCookie("userInfo")
        aCookie.Values("UserID") = UserID
        aCookie.Values("FirstName") = First
        aCookie.Values("LastName") = Last
        aCookie.Values("Rights") = Rights
        aCookie.Expires = DateTime.Now.AddDays(1)

Open in new window

I want to be able to access these cookie values from the other two sub domains?  Is there a way for me to modify the code I used to create the cookie OR the code below so I can access these values across sub domains?

Label1.Text = Server.HtmlEncode(Request.Cookies("userInfo")("UserID")) 

Open in new window

Question by:cdemott33
    LVL 58

    Expert Comment

    Set the cookie without a sub domain.

    Author Comment

    Can you provide an example on how to do that?
    LVL 58

    Accepted Solution

    Response.Cookies("CookieName").Domain = ""

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now