I want to set cookies for a specific domain to fetch data in English version in C# while crawling the website. Suppose a website www.xyz.com has four language version including English. The actual data in database are in any other language (suppose Swedish). While crawling the site to get all of its links and text, need to fetch the contents of English version. That's why I want to set cookies there. But it's not working. Please check the piece of code below to set cookie for English version.
if (_domain == "www.xyz.com")
{
HttpCookie CreateLangCookie()
{
HttpCookie cookie = new HttpCookie("Cookies");
cookie.Name = "lang";
cookie.Value = "en";
cookie.Domain = ".xyz.com";
cookie.Path = "/";
cookie.Expires = DateTime.MaxValue;
return cookie;
}
Response.Cookies.Add(CreateLangCookie());
}