473,387 Members | 3,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SSL: "An existing connection was forcibly closed by the remote host."

Hello,
I'm trying to do a secure connect to the site https://212.77.100.18/p/ with
..net 2.0 HttpWebRequest class,
unfortunately for some reason I'm not able to do that - WebException is
thrown with inner exception message of "An existing connection was forcibly
closed by the remote host."

I hoped I'll solve my problem with RemoteCertificateValidationCallback
delegate which always returns "true", but it isn't called at all for this
site (but works for other sites which needs manual acceptance of
certificate).

The HttpWebResponse should return "403 Forbidden" as in Internet Explorer.

Can you help me, please?

//my code below

ServicePointManager.ServerCertificateValidationCal lback
+= new
System.Net.Security.RemoteCertificateValidationCal lback(ValidateServerCertificate);

HttpWebRequest req =
(HttpWebRequest)WebRequest.Create("https://212.77.100.18/p/");
req.Method = "GET";
req.AllowAutoRedirect = false;
req.CookieContainer = new CookieContainer();
req.KeepAlive = true;
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC
4.0; .NET CLR 2.0.50727)";
req.ContentType = "application/x-www-form-urlencoded";
req.Accept = "*/*";
/*
I have also tried this:
req.ClientCertificates.Add(X509Certificate.CreateF romCertFile("chris.cer"));
*/
using (HttpWebResponse res =
(HttpWebResponse)req.GetResponse())
{
//not reached
}

public static bool ValidateServerCertificate(object sender,
X509Certificate certificate, X509Chain chain, SslPolicyErrors
sslPolicyErrors)
{
return true;
}

Apr 12 '06 #1
0 1942

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Adam Clauss | last post by:
I am trying to work-around a firewall which limits me to only being able to accept inbound connections on port 80. Unfortunately, I need to two different applications to be able to accept...
0
by: Bigdave | last post by:
hi Ive recently started coding a small project in c# using microsofts 2005 beta, i am trying to setup a small application that will send a string to a server via udp, then for that same app to...
0
by: Mike | last post by:
VB .NET 2003, Pocket PC 2003, CF 1.0 SP 2 Only when I use a proxy server, I'm getting this error when attempting to write data to a Stream object from an HTTPWebRequest object....
2
by: joel.washburn | last post by:
I'm looking for some information on why fread calls max out CPU usage on SSL connections in windows. I've tried upgrading PHP (now at 5.1.2) and OpenSSL (now 9.8) but cannot stop fread() from...
2
by: Jan | last post by:
Is it possible to somehow redirect users to a cutom page if their browsers/firewall do not support SSL? Almost like a customized 404 page? We'd like to offer SSL form submits by default, but...
1
by: Jim Hubbard | last post by:
We are using a .Net 2.0 app that connects to a SQL 2005 Express DB and we keep getting this message on the clients. Has anyone seen this error or a solution to it?
1
by: rhepsi | last post by:
hii all, When im trying to upload all the resized photos from the local server onto the live ftp server, im getting an error stating tht: "An existing connection was forcibly closed by the...
1
by: nothing1 | last post by:
My situation is this. There is a remote server that requires authentication to access a file name that i sell and give them expiring link. Auth link...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.