Here is the Code:
private
string HttpContent( string url ){
String result="";
try{
HttpWebResponse objResponse;
HttpWebRequest objRequest = ((HttpWebRequest) (WebRequest.Create(url)));
objRequest.Method ="GET";
objRequest.Timeout = 90000;
objRequest.KeepAlive =
false;objRequest.ProtocolVersion=HttpVersion.Version10;
ServicePointManager.Expect100Continue =
false;objRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040707 Firefox/0.9.2";
//objRequest.Accept = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; //objRequest.ContentType = @"application/x-www-form-urlencoded"; //IWebProxy proxyObject = //new WebProxy("http://localhost:8099", false); //objRequest.Proxy=proxyObject; //objRequest.Proxy=GlobalProxySelection.GetEmptyWebProxy(); //objRequest.Proxy = WebProxy.GetDefaultProxy(); //objRequest.Proxy.Credentials = CredentialCache.DefaultCredentials; //objRequest.AllowAutoRedirect=true; //objRequest.MaximumAutomaticRedirections=10; //objRequest.Timeout=(int) new TimeSpan(0,1,0).TotalMilliseconds; //objRequest.UserAgent="Mozilla/3.0 (compatible; My Browser/1.0)";objResponse = ((HttpWebResponse) (objRequest.GetResponse()));
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()) ){
result = sr.ReadToEnd();
result=result.Replace("javascript: window.print()","");
result=result.Replace("../Images/newsletter","http://www.nadp.org/images/newsletter");
// Close and clean up the StreamReadersr.Close();
}
objResponse.Close();
}
catch(Exception ex){
Response.Write(ex.Message.ToString());
}
return result;}
Thanks In Advance
BajinderPosted Apr 4, 2007, 6:31 AM
jaimenPosted Apr 4, 2007, 5:26 AM
Check out in your web.config file whether you have any web service which is running on a different sytem and make sure that the system is not shut down. And also ensure that remote service URL of the machine it is pointing to is not shut down.
this should solve your problem...