Web Services .net framework 2 over SSL

I have just ported an ASP.NET 1.1 application to framework version 2 and i have a problem.

I used to use the following code in framework 1.1.

//
// workaround to make the webservice call work over ssl
//
System.Net.ServicePointManager.CertificatePolicy =newWebServicePolicyHelper();

MyWebService ws =newMyWebService();

result = ws.MyMethod(params...);

When I compile the program in framework Version 2, it tells me that 'CertificatePolicy' is obsolete and tells me to use 'ServerCertificateValidationCallback' instead.

I can't find any help on how to use this class. Has anybody used this?

Any help will be appreciated.

Dave Bates

[1263 byte] By [Dave_Bates] at [2008-2-21]
# 1
Hi,

Here's an example for FTP, but shows the usage of ServerCertificateValidationCallback

http://blogs.msdn.com/adarshk/archive/2005/04/22/410925.aspx

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 2
Thanks again Vikram,

This has sorted my compiler warnings but I get an error "Authentication failed because the remote party has closed the transport stream", any ideas?

Dave

Dave_Bates at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 3

I've just figured out the reason for the error message. It's because the target web server does not have an ssl certificate.

Anyway thanks again for your help.

Dave

Dave_Bates at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 4
Hi,
I want to consume a Webservice over SSL on the Compact Framework 2.0.
In my WinForms App I'm using ServerCertificateValidationCallback, but that seems to have been removed from the CF.net 2.0?
I would have fallen back to using the magic AcceptAllCertificatePolicy, but
System.Net.ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();
actually tells me that ICertificatPolicy is defined in a not referenced assembly. It tells me to reference System, Version 2.0.0.0, culture=neutral. Well looking in my references lists, of course System is referenced and yes the versions are identical, just the culture field is empty, which I am supposing means neutral?
Can you help me on this one?
Gidion at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...

.NET Development

Site Classified