A
archana
Hi all,
I am having confusion regarding following code:-
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create( url );
WebResponse resp = wr.GetResponse();
MessageBox.Show(resp.ResponseUri.ToString());
Above code fails for some url. It was giving error 'The remote server
returned an error: (500) Internal Server Error.'
But i open that url is IE that url was getting opened properly.
So then i modified above code and added following line
wr.UserAgent ="Mozilla/4.0 (compatible; MSIE 6.0; Win32)";
those urls where working properly.
Can someone tell me why this is happening?
What is use of specifying useragent instead of null to above value.
Please help me asap.
Thanks in advance.
I am having confusion regarding following code:-
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create( url );
WebResponse resp = wr.GetResponse();
MessageBox.Show(resp.ResponseUri.ToString());
Above code fails for some url. It was giving error 'The remote server
returned an error: (500) Internal Server Error.'
But i open that url is IE that url was getting opened properly.
So then i modified above code and added following line
wr.UserAgent ="Mozilla/4.0 (compatible; MSIE 6.0; Win32)";
those urls where working properly.
Can someone tell me why this is happening?
What is use of specifying useragent instead of null to above value.
Please help me asap.
Thanks in advance.