0

I have a web site which stores a cookie in the browser now by windows service I want to access the cookie.

How can this be possible?

  • Your question is a little bit unclear. Further state your intent. Do you want to install a windows service on the _client computers_, which runs the browser that at one point connected to your website...? Why would you want to do this? – Tewr Sep 08 '17 at 10:55
  • @Tewr let's say there is a website which has created a cookie for the user with user name, Assume that the browser created a cookie with the user name. Now I want a windows service to get the cookie with the username – Ranjeet Jain Sep 08 '17 at 11:11
  • Which browser do you mean? – Tewr Sep 08 '17 at 11:15
  • Given that cookies are stored differently between different browsers and that they exist on a per-user basis (and your service is will run under a different account) this is harder than you think, what is your ultimate aim? – Alex K. Sep 08 '17 at 11:19
  • @Tewr it can be any browser, for now, let's consider chrome. – Ranjeet Jain Sep 08 '17 at 11:29
  • @AlexK.I just want to retrieve the information and display it. – Ranjeet Jain Sep 08 '17 at 11:29
  • @RanjeetJain - Internet explorer stores Cookies in a bunch of different folders depending on configuration. Chrome stores cookies in an encrypted SQLLite database. Firefox stores it in random files. So you need a specific question or you wont get a specific answer. Also, Doing this from a service complicates things as a service does not neccessarily tie you to a session. – Tewr Sep 08 '17 at 12:00
  • @tewr lets say it's chrome browser.. now how can I access chrome browsers cookie data ? Can you give a solution atleast one of the browser or chrome ? Anything which can give me a basic idea of how can I achieve it. – Ranjeet Jain Sep 09 '17 at 06:07
  • Sure, here's the basic idea: https://stackoverflow.com/questions/22532870/encrypted-cookies-in-chrome Probably not usable directly from a service though, due to `ProtectedData.Unprotect` method with CurrentUser argument – Tewr Sep 12 '17 at 07:01

0 Answers0