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. General Programming
  3. .NET (Core and Framework)
  4. Do SOAP-based web services see clients' cookies?

Do SOAP-based web services see clients' cookies?

Scheduled Pinned Locked Moved .NET (Core and Framework)
wcfquestioncsharpdotnetsecurity
6 Posts 2 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
    Mark Schumann
    wrote on last edited by
    #1

    Hi all. I hope this is the right forum section for this kind of question. My production environment gives the user a cookie that contains encrypted authorization data. My web service (which does not produce the cookie) is expected to read the value of the cookie, do some magic with it, and extract the name of the authorized user. That's what they give me. A cookie. The client side calls my service via SOAP and passes the cookie value through the "Cookie:" header. All other headers are seen by the service, but "Cookie:" is not. (I can see that Context.Request.Cookies is empty, and Context.Request.ServerVariables contains all of my headers except "HTTP_COOKIE".) I can even pass my cookie data in another header, as long as it's not called "Cookie:". It sure looks as though .NET doesn't want services to see cookies, to the point of filtering out the "Cookie:" header when it's sent. My question is--am I crazy, or does the .NET Framework remove cookies from SOAP web service requests? And if so, is there a way to override that behavior, other than by building an equivalent to the "Cookie:" header and parsing it on the service side? Again, the user is already authenticated through another mechanism, they already have the cookie, and I'm supposed to use the cookie to figure out who's making the request. Thanks in advance for any insights as to how .NET Framework handles cookies on web service requests.

    L 1 Reply Last reply
    0
    • M Mark Schumann

      Hi all. I hope this is the right forum section for this kind of question. My production environment gives the user a cookie that contains encrypted authorization data. My web service (which does not produce the cookie) is expected to read the value of the cookie, do some magic with it, and extract the name of the authorized user. That's what they give me. A cookie. The client side calls my service via SOAP and passes the cookie value through the "Cookie:" header. All other headers are seen by the service, but "Cookie:" is not. (I can see that Context.Request.Cookies is empty, and Context.Request.ServerVariables contains all of my headers except "HTTP_COOKIE".) I can even pass my cookie data in another header, as long as it's not called "Cookie:". It sure looks as though .NET doesn't want services to see cookies, to the point of filtering out the "Cookie:" header when it's sent. My question is--am I crazy, or does the .NET Framework remove cookies from SOAP web service requests? And if so, is there a way to override that behavior, other than by building an equivalent to the "Cookie:" header and parsing it on the service side? Again, the user is already authenticated through another mechanism, they already have the cookie, and I'm supposed to use the cookie to figure out who's making the request. Thanks in advance for any insights as to how .NET Framework handles cookies on web service requests.

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Mark Schumann wrote:

      My question is--am I crazy, or does the .NET Framework remove cookies from SOAP web service requests?

      I don't know the answer to that. If you really must know grab one of the several free packet sniffers and take a look at what is actually transmitted. That said, something is not correct in your scenario. The SOAP message should be designed to carry that information and not rely on something like cookies since SOAP is not reliant on HTTP as it's transport.

      led mike

      M 1 Reply Last reply
      0
      • L led mike

        Mark Schumann wrote:

        My question is--am I crazy, or does the .NET Framework remove cookies from SOAP web service requests?

        I don't know the answer to that. If you really must know grab one of the several free packet sniffers and take a look at what is actually transmitted. That said, something is not correct in your scenario. The SOAP message should be designed to carry that information and not rely on something like cookies since SOAP is not reliant on HTTP as it's transport.

        led mike

        M Offline
        M Offline
        Mark Schumann
        wrote on last edited by
        #3

        Good answer--why am I expecting SOAP to carry my HTTP headers in the first place? :rolleyes: Thanks for the perspective, and for the smack in the head. What do you think would be "best practice" if I want to push the contents of that cookie (which is all the authentication system gives me to work with) to my web service? I'm thinking it should be just another element in the SOAP request. Is there a more elegant way to do what I'm trying to do?

        L 1 Reply Last reply
        0
        • M Mark Schumann

          Good answer--why am I expecting SOAP to carry my HTTP headers in the first place? :rolleyes: Thanks for the perspective, and for the smack in the head. What do you think would be "best practice" if I want to push the contents of that cookie (which is all the authentication system gives me to work with) to my web service? I'm thinking it should be just another element in the SOAP request. Is there a more elegant way to do what I'm trying to do?

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          Mark Schumann wrote:

          What do you think would be "best practice" if I want to push the contents of that cookie (which is all the authentication system gives me to work with) to my web service?

          http://msdn2.microsoft.com/en-us/library/ms951273.aspx[^]

          led mike

          M 1 Reply Last reply
          0
          • L led mike

            Mark Schumann wrote:

            What do you think would be "best practice" if I want to push the contents of that cookie (which is all the authentication system gives me to work with) to my web service?

            http://msdn2.microsoft.com/en-us/library/ms951273.aspx[^]

            led mike

            M Offline
            M Offline
            Mark Schumann
            wrote on last edited by
            #5

            Outstanding, Mike--that's exactly what I was looking for! I appreciate your help on this.

            L 1 Reply Last reply
            0
            • M Mark Schumann

              Outstanding, Mike--that's exactly what I was looking for! I appreciate your help on this.

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #6

              Mark Schumann wrote:

              I appreciate your help on this.

              Ok, I didn't really do anything but thanks. :) Good luck with the project.

              led mike

              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