Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Error in WebService

  Asked By: Tarang Upadhya         Date: Feb 27, 2009      Category: Sharepoint      Views: 166
 

'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.

Tagged:      

 

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.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].