Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Error in WebService

  Asked By: Jill    Date: Apr 01    Category: Sharepoint    Views: 907

here I'm attaching my code snippet used in my web service along with this post.

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:

public static string GetWebSiteContent(string url)
string content;

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();

return content;
catch (WebException ex)
return content = ex.Message;



1 Answer Found

Answer #1    Answered By: Jagdish Joshi     Answered On: Apr 01

Can you access internet from the server box .. if u can then try hardcoding
http://www.google.com for the Url Parameter u are passing  to this function.
if u are not getting error  now.. ur code  is correct ...

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