'm attaching my code snippet used in my web service along with this mail.
when every i run my code in an webpart i get following Error message:
"The remote name could not be resolved: 'MYSITE.com' "...here
mysite.com the url i'm passing which is valid
can u please suggest me the appropriate corrections:
Code:
public static string GetWebSiteContent(string url)
{
string content;
try
{
WebRequest WebReq;//WebRequest
HttpWebResponse WebRes;//WebResponse
StreamReader sr;
WebReq = HttpWebRequest.Create(url);
WebRes = WebReq.GetResponse();
// WebRes = (HttpWebResponse)WebReq.GetResponse();
Encoding enc = Encoding.GetEncoding(1252);
sr = new StreamReader(WebRes.GetResponseStream(),enc);
content = sr.ReadToEnd();
sr.Close();
return content;
}
catch (WebException ex)
{
return content = ex.Message;
}
}
Do you know someone who can help? Share a link to this thread on twitter, or facebook.