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. C#
  4. How Can We Extract A String From A Cookie, In Windows Form

How Can We Extract A String From A Cookie, In Windows Form

Scheduled Pinned Locked Moved C#
helpcsharpasp-netwinforms
6 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.
  • B Offline
    B Offline
    babak_izadi
    wrote on last edited by
    #1

    Dear Friends, I have a problem. I want to use a cookie for some kind of data sharing between the Web Based part of my App. and the Windows Based part. (I insert my desired value in a cookie using Asp .Net, but I can not read it from my Windows Forms!) The problem is, when I extract the Data With HttpWebRequest obj, that string is something like an encrypted string! something like this : 12wec4hdnx56ye4fdh (and it's not fixed) I'll be thankful if you would help me. Regards, Babak P.S. I tried it with a Web Service method, but the problem is still the same !! There is no problem when I read it in an ASP.Net page.

    P G 2 Replies Last reply
    0
    • B babak_izadi

      Dear Friends, I have a problem. I want to use a cookie for some kind of data sharing between the Web Based part of my App. and the Windows Based part. (I insert my desired value in a cookie using Asp .Net, but I can not read it from my Windows Forms!) The problem is, when I extract the Data With HttpWebRequest obj, that string is something like an encrypted string! something like this : 12wec4hdnx56ye4fdh (and it's not fixed) I'll be thankful if you would help me. Regards, Babak P.S. I tried it with a Web Service method, but the problem is still the same !! There is no problem when I read it in an ASP.Net page.

      P Offline
      P Offline
      painlessprod
      wrote on last edited by
      #2

      you need to have private System.Net.CookieContainer Cookies = new System.Net.CookieContainer(); mt.CookieContainer = Cookies; where mt is your webservice

      B 1 Reply Last reply
      0
      • P painlessprod

        you need to have private System.Net.CookieContainer Cookies = new System.Net.CookieContainer(); mt.CookieContainer = Cookies; where mt is your webservice

        B Offline
        B Offline
        babak_izadi
        wrote on last edited by
        #3

        Would you please explain it more ? what is mt?! the web service that do what, and how ?

        P 1 Reply Last reply
        0
        • B babak_izadi

          Would you please explain it more ? what is mt?! the web service that do what, and how ?

          P Offline
          P Offline
          painlessprod
          wrote on last edited by
          #4

          sorry, the web service that your windows form has subscribed to with the following private System.Net.CookieContainer Cookies = new System.Net.CookieContainer(); public localhost.Service1 mt = new localhost.Service1(); mt.CookieContainer = Cookies;

          B 1 Reply Last reply
          0
          • P painlessprod

            sorry, the web service that your windows form has subscribed to with the following private System.Net.CookieContainer Cookies = new System.Net.CookieContainer(); public localhost.Service1 mt = new localhost.Service1(); mt.CookieContainer = Cookies;

            B Offline
            B Offline
            babak_izadi
            wrote on last edited by
            #5

            Excuse me please, but what is the structure of my webservice ?! what should it do?!

            1 Reply Last reply
            0
            • B babak_izadi

              Dear Friends, I have a problem. I want to use a cookie for some kind of data sharing between the Web Based part of my App. and the Windows Based part. (I insert my desired value in a cookie using Asp .Net, but I can not read it from my Windows Forms!) The problem is, when I extract the Data With HttpWebRequest obj, that string is something like an encrypted string! something like this : 12wec4hdnx56ye4fdh (and it's not fixed) I'll be thankful if you would help me. Regards, Babak P.S. I tried it with a Web Service method, but the problem is still the same !! There is no problem when I read it in an ASP.Net page.

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

              The cookie is stored in the browser, not in the web server. You can't get the value using a WebRequest, as the value is sent to the server, not from the server. If you want the value you have to store it elsewhere. --- 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