Hi
The issue is solved and everything works ok now.
The issue you are talking about is the most common issue and can be solved this way:
http://blogs.x2line.com/al/articles/258.aspx
ICertificatePolicy is the first thing people think about, but it was not it.
My problem was different. The problem was throwing inconsistent errors of: "The underlying connection was closed: Could not establish secure channel for SSL/TLS" connecting to the remote server via https; our client is asp.net application. Although if you
Google this issue - there are lots of people having the same problem without finding any solution. I've spent a lot time on this.
Solution:
Setting KeepAlive property to false of HttpWebRequest solves entirely the issue. It seems that there is some leak of connections despite the fact that the underlying streams are closed properly and HttWebResponse is closed explicitly, too. The main difficulty that the problem is inconsistent and 95% of the time everything worked properly.
Also I know now that one should use HttWebRequest/HttpWebResponse and not WebRequest/WebResponse because it is more reliable, at least if you google it there are lots of issues of inconsistent behaviour. The same is about WebClient since it uses WebRequest, you can see it in Reflector.
thanks.