A question about URI in c#

mrpega

Regular Member
Joined
Sep 19, 2008
Messages
393
Reaction score
105
Does for example declaring:

Uri u = new Uri("http://www.google.com");

actually means that the application has accessed the page like a real human has enter the url into browser?
 
Uri is only a Data-Class.

How do you access the web?

What do you want to do?
 
sorry i meant if i put :

WebRequest http = HttpWebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)http.GetResponse();
Stream stream = response.GetResponseStream();

after the uri declaration..thanks for the help!!
 
hmm i don't know. I access websites via the webclient-class. This "simulates" the Browser...
 
using (WebClient wc = new WebClient() )
{
wc.Proxy=null;
wc.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

//if authenticated add a credential set
string userName="[email protected]";
string password = "mypass";
wc.Credentials = new NetworkCredential(userName, password);

wc.DownloadData("http://yoursite.com/");
}
 
Back
Top