Sorry the error returned is : System.Net.WebException:Co
Cheers
A.
Main Topics
Browse All TopicsHi there,
I am using the following code to send via HTTP but I would rather send via HTTPS, if i change the http to https it crashes. Any healp would be wonderful..
// Create a new 'HttpWebRequest' object to the mentioned Uri.
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest
myHttpWebRequest.AllowWrit
string postData = fileLine;
// Set 'Method' property of 'HttpWebRequest' class to POST.
myHttpWebRequest.Method = "POST";
ASCIIEncoding encodedData = new ASCIIEncoding();
byte[] byteArray=encodedData.GetB
// Set 'ContentType' property of the 'HttpWebRequest' class to "application/x-www-form-ur
myHttpWebRequest.ContentTy
// If the AllowWriteStreamBuffering property of HttpWebRequest is set to false,the contentlength has to be set to length of data to be posted else Exception(411) is raised.
myHttpWebRequest.ContentLe
Stream newStream=myHttpWebRequest
newStream.Write(byteArray,
newStream.Close();
// Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWeb
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
K, we can start from there...
This problem is ussually associated with the site ssl certificate. Tell me something: if you access the site (with https, of course) using a browser, do you see any popup or message related to the certificate?
There's a common workaround for this issue, but it's not the most secure. It's based in create a new certificatepolicy that accepts all certificate. Here's a class that you can use:
public class TrustThemAll: System.Net.ICertificatePol
{
public TrustThemAll()
{}
public bool CheckValidationResult(Serv
X509Certificate cert,WebRequest req, int problem)
{
return true;
}
}
Then in your code, before declaring the HttpWebRequest you would do:
ServicePointManager.Certif
HttpWebRequest ........ //your code continues here.
Check the site using your browser and implement this workaround. Let me know if you get any good result.
Good luck :)
Esteban Felipe
www.estebanf.com
Thanks for the suggestion. I implemented your change but unfortunately I am still receiving the same error. System.net.WebException : The remote name could not be resolved.
When i try and access the cgi through a browser it works fine, no cert messages, just the standard "No document received."
Regards
Marcus
But the exception changed. It used to be: "Could not establish trust relationship with remote server" and now it's "The remote name could not be resolved". Do you have access from the pda to the site? and what do you mean with "the standard no document recieved"? is the target page expecting something?
Still not working!!
It works once then i get the "A blocking operation is currently excuting"!! I close the response and the stream??
What is there left to close?
// Ensure the trust relation ship for
ServicePointManager.Certif
// Create a new 'HttpWebRequest' object to the mentioned Uri.
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest
// Set AllowWriteStreamBuffering to 'false'.
myHttpWebRequest.AllowWrit
myHttpWebRequest.KeepAlive
string postData = fileLine;
Set 'Method' property of 'HttpWebRequest' class to POST.
myHttpWebRequest.Method = "POST";
ASCIIEncoding encodedData = new ASCIIEncoding();
byte[] byteArray=encodedData.GetB
// Set 'ContentType' property of the 'HttpWebRequest' class to "application/x-www-form-ur
myHttpWebRequest.ContentTy
// If the AllowWriteStreamBuffering property of HttpWebRequest is set to false,the contentlength has to be set to length of data to be posted else Exception(411) is raised.
myHttpWebRequest.ContentLe
Stream newStream=myHttpWebRequest
newStream.Write(byteArray,
newStream.Close();
// Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWeb
myHttpWebResponse.Close();
Business Accounts
Answer for Membership
by: esteban_felipePosted on 2004-03-20 at 23:24:33ID: 10643145
Hi astrofunkunator,
what do you mean with "it crashes"? what exception is it throwing?. That information will be useful to find out a solution
Esteban Felipe
www.estebanf.com