How do I programmatically request a URL in ASP.NET?

asp.net, url

Solution

If you want to call another page and get the response back as string, you can use `WebClient` class.

var myWebClient = new WebClient();
string resultStr = myWebClient.DownloadString("http://www.google.com");

Problem

I would like the server to call a URL (an ashx page) programmatically and store the response as a string. Using HttpWebRequest doesn't seem like it will work properly because I do not want to redirect the client there. Thanks.

Original source