Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need to know how to read user's search history by cookies, i.e., how I can track my cookies and get the list of keywords/text used in the search engines by the user. Is it possible please suggest some ideas to do it? or How I can achieve this by C#/ASP.Net State management?

Thanks in advance.

What I have tried:

Cookies are the domain name perspective, I tried to read my own site search history, but I failed.
Posted
Updated 18-Nov-18 8:27am

1 solution

Cookies are available via Request.Cookies collection. To read your custom defined cookies, you can simply do something like this:

C#
if(Request.Cookies["YourKey"]!=null)
{
   var myCookie = Request.Cookies["YourKey"].Value;
}


For more information, refer the official documentation here: How to: Read a Cookie[^]

If you are trying to access cookies from other websites (e.g search engine websites), then You can't. You can only access cookies sent to your server. You can't read the cookies of other websites, that would be a HUGE security flaws.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900