Reading Cookies from windows application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PreethiParkavi
    New Member
    • Jan 2008
    • 16

    Reading Cookies from windows application

    Hi All,
    I am developing a download manager for a a website downloads.The problem is , I have to login in my windows application with same user credentials of web login when I logging in web application.In web application , I set cookies with user credentials ; but, Not able to read them in windows.I have tried the ideas suggested by http://p2p.wrox.com/topic.asp?TOPIC_ID=29325 .
    I am not able to read the cookies created in Firefox while scanning cookie folder.When I am trying to read through HttpRequest , It only returns the ASP_net cookie.
    How do I capture the credential of web login from my desktop application.Ple ase Help Me.

    Regards,
    Preethi
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Couldn't you just set your own?
    When I use HttpWebRequest, I can see the cookies that are trying to be created and keep track of them.


    Or are you trying to use "already logged in" user information, aka snooping through the cookies stored by the browser already?

    Comment

    • PreethiParkavi
      New Member
      • Jan 2008
      • 16

      #3
      Hi,
      I am trying to use HttpWebReques.w hile using the code,
      Code:
       HttpWebRequest request = [B](HttpWebRequest)WebRequest.Create(url)[/B];
       request.CookieContainer = new CookieContainer();
       HttpWebResponse response = (HttpWebResponse) request.GetResponse();
       response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);
      It seems that It creates a new request to URL and hence no one is logged in through this code; so, no cookie for user credentials is created and am not getting such a cookie.From Here , How do I proceed ?.please help me.

      Thanks with anticipation,
      Preethi.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        You can use the HttpWebReuest to log in. Get the user credentials from the user (texboxes?) Then go through the login motions and receive the cookie from the response object. Then just make sure to keep that cookie in all your requests?

        Comment

        • PreethiParkavi
          New Member
          • Jan 2008
          • 16

          #5
          Hi Plater,
          Thank you for your quick replies.I Got your point of "Using user credentials for all logins".but, the problem is,I want to auto login in my windows application when web page gives some download links.at that time ,my windows application (Download Manager) has to log in and display previous downloads of the user . I have created a window service which is identifying a download link clicked and invoke the windows application.I works the fine if user credential are not needed (without any auto login).Now, I want auto login with user credentials. Is there any other way that a web page to leave some user credential in a client system (such as file,XML ) and captured by a windows application?.

          Thanks,
          Preethi

          Comment

          • NitinSawant
            Contributor
            • Oct 2007
            • 271

            #6
            Originally posted by Plater
            You can use the HttpWebReuest to log in. Get the user credentials from the user (texboxes?) Then go through the login motions and receive the cookie from the response object. Then just make sure to keep that cookie in all your requests?
            Yo, plater bro,
            Can you post some example for loging into website using above method??

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              Ah ok, you have your program working in tandum with the browser.
              So when a user is at a site and clicks a link to download, your pogram popups up and goes through the motions of downloading it?

              Did you install your services to act as a web proxy? If so, user credentials will be sent to the proxy device and can be read from the user request that gets sent to it.

              As for retreiving user credentials in your situation, without getting to see the full original request, I'm stumped at the moment.

              Comment

              Working...