Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. accesing a cookie from two different web applications

accesing a cookie from two different web applications

Scheduled Pinned Locked Moved ASP.NET
question
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    marcossl
    wrote on last edited by
    #1

    hey, i wrote some code in Application1 that encrypts a string and saves it in a cookie, and i want to retrieve that string from the cookie i saved from Application 2. My question is: how can i access the same cookie from two different web applications? Thanks

    G 1 Reply Last reply
    0
    • M marcossl

      hey, i wrote some code in Application1 that encrypts a string and saves it in a cookie, and i want to retrieve that string from the cookie i saved from Application 2. My question is: how can i access the same cookie from two different web applications? Thanks

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      You can only do that if the applications use the same domain name. Cookies are private to the domain, for security reasons. --- b { font-weight: normal; }

      M 1 Reply Last reply
      0
      • G Guffa

        You can only do that if the applications use the same domain name. Cookies are private to the domain, for security reasons. --- b { font-weight: normal; }

        M Offline
        M Offline
        marcossl
        wrote on last edited by
        #3

        first of all , thanks guffa. In fact, i set the domain "localhost" in the cookie but it seems not to work

        G 1 Reply Last reply
        0
        • M marcossl

          first of all , thanks guffa. In fact, i set the domain "localhost" in the cookie but it seems not to work

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          How do you create the cookie? --- b { font-weight: normal; }

          M 1 Reply Last reply
          0
          • G Guffa

            How do you create the cookie? --- b { font-weight: normal; }

            M Offline
            M Offline
            marcossl
            wrote on last edited by
            #5

            this way: HttpCookie simpleCookie = new HttpCookie( "testCookie" ); simpleCookie.Domain = "localhost"; simpleCookie.Path = "/";

            G 1 Reply Last reply
            0
            • M marcossl

              this way: HttpCookie simpleCookie = new HttpCookie( "testCookie" ); simpleCookie.Domain = "localhost"; simpleCookie.Path = "/";

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              From MSDN: "Setting the Domain attribute limits transmission of the cookie to clients requesting a resource from that domain." This means that the cookie will only be sent to the browser if it requests a page from the domain specified. You cannot use the domain property to inject a cookie into a different domain. --- b { font-weight: normal; }

              K 1 Reply Last reply
              0
              • G Guffa

                From MSDN: "Setting the Domain attribute limits transmission of the cookie to clients requesting a resource from that domain." This means that the cookie will only be sent to the browser if it requests a page from the domain specified. You cannot use the domain property to inject a cookie into a different domain. --- b { font-weight: normal; }

                K Offline
                K Offline
                kanebarton
                wrote on last edited by
                #7

                So you are trying to use the same cookie on the same server that has 2 different virtual directories setup? If so then you can do the quick and dirty and post all cookie values (from Virutal Directory 1) in a form (Html Hidden input) to the a seperate CookieMigration page (in Virutal Directory 2). The CookieMigration page would simply loop through all of the form values and then place them into a new cookie.

                G 1 Reply Last reply
                0
                • K kanebarton

                  So you are trying to use the same cookie on the same server that has 2 different virtual directories setup? If so then you can do the quick and dirty and post all cookie values (from Virutal Directory 1) in a form (Html Hidden input) to the a seperate CookieMigration page (in Virutal Directory 2). The CookieMigration page would simply loop through all of the form values and then place them into a new cookie.

                  G Offline
                  G Offline
                  Guffa
                  wrote on last edited by
                  #8

                  No, not me. --- b { font-weight: normal; }

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups