I am working on a small program to automate some IT tasks. The program works by having the user paste an email header text into a textbox and then parsing the text to find out important aspects of the email to inspect.
One functionality I cannot seem to figure out is the domain location. I would like to be able to look up domains to figure out their origin, activity, existence, etc. I am using the website VirusTotal for this because it is free to use and provides a decent amount of information.
For some reason, I cannot properly use the HttpWebRequest + HttpWebResponse methods for this site. I tried doing this on other sites like Google, Microsoft, Sony, etc. and they all worked just as expected by downloading the HTML code. Instead of downloading HTML code, all I get from the web response from VirusTotal is two ASCII characters (they look like black squares). What is causing this and what are my workarounds?
Here is my exact code for this
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.virustotal.com/#/domain/" + domain);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = null;
if (response.CharacterSet == null)
{
readStream = new StreamReader(receiveStream);
}
else
{
readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
}
string page = readStream.ReadToEnd();
response.Close();
readStream.Close();
MessageBox.Show(page);
}