Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Error in WebService

  Asked By: Tarang    Date: Feb 27    Category: Sharepoint    Views: 720

'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;
}
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Error in WebService Or get search suggestion and latest updates.




Tagged: