Click here to Skip to main content
15,920,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i have used the following method to send the file to validate the url but i am not getting any responce and my browser is in connecting stage and my code is as follows pl tell me how to solve it

my code is as follows

<pre lang="c#">
string url = "http://www.inspire-geoportal.eu/INSPIREValidatorService/resources/validation/inspire";
HttpWebRequest webRequest = WebRequest.Create(url) as HttpWebRequest;
webRequest.Headers.Clear();
webRequest.Headers.Add("Authorization", "text/html");
webRequest.Method = "POST";
webRequest.PreAuthenticate = true;
webRequest.ContentType = "application/xml";
webRequest.Credentials = CredentialCache.DefaultNetworkCredentials ;//.DefaultCredentials;
webRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
webRequest.Timeout = 150000;
// Create POST data and convert it to a byte array.
webRequest.ContentLength = formData.Length;
WebResponse webResponse = null;
StreamReader objSR;
System.Text.Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
Stream objStream;
string sResponse;
webResponse = (HttpWebResponse)webRequest.GetResponse();
objStream = webResponse.GetResponseStream();
objSR = new StreamReader(objStream, encode, true);
//<<sResponse doesn't contain Unicode char values>>
sResponse = objSR.ReadToEnd();
Response.Write(sResponse);
</pre>
Posted

1 solution

reduce the timeout to check what is the error..., take the decision based on the error description.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900