473,466 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

unable to connect a https-based third-party web service in my web service

Code like the following .

[WebMethod]
public string HelloWorld()
{
System.Net.ServicePointManager.CertificatePolicy=n ew CertificateEx();
System.Net.HttpWebRequest
req=(System.Net.HttpWebRequest)System.Net.WebReque st.Create(https://example.
com) ; //this site does not require client certificate
System.Net.HttpWebResponse
res=(System.Net.HttpWebResponse)req.GetResponse();
return new System.IO.StreamReader (res.GetResponseStream()).ReadToEnd() ;
}

public class CertificateEx: System.Net.ICertificatePolicy
{
#region ICertificatePolicy ³ÉÔ±

public bool CheckValidationResult(System.Net.ServicePoint srvPoint,
System.Security.Cryptography.X509Certificates.X509 Certificate certificate,
System.Net.WebRequest request, int certificateProblem)
{
// TODO: Ìí¼Ó CertificateEx.CheckValidationResult ʵÏÖ
return true;
}

#endregion
get the error says:

The underlying connection was closed: Could not establish trust relationship
with remote server.

--
Thank you for your time!

Nov 21 '05 #1
0 1823

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

Similar topics

2
by: Mark Delon | last post by:
Hi, i want to log via python script to https page: 'https://brokerjet.ecetra.com/at/' # But it does not work. I am using following code(see below)
1
by: dina_vr | last post by:
Hi All, I am getting lot of System.IO.IOException: Unable to write data to the transport connection. exceptions when I write to a Stream which is connected to a Remote HTTPS server using a...
3
by: yaron | last post by:
Hi, 1. How to use SSL to connect 2 c# console application clients ? 2. Ineroperability with Java : How to use SSL to connect C# console application client and JAVA console application client...
0
by: Subra Mallampalli | last post by:
Hi, I am trying to connect over HTTPS using a client certificate. I am able to connect fine when using IE. From my application, however, I get the following error: The underlying connection...
2
by: leeo | last post by:
This is driving me absolutely mad. We've been using this code to connect to a remote site: System.Net.ServicePointManager.CertificatePolicy = New cCertificatePolicy wr =...
5
by: Arno | last post by:
reposted with the right microsoft managed newsgroup ID: Sorry for the inconvinience Hi, I've written a class for client-socket connection, but I get a lot of times the error message "Unable...
1
by: gujarsachin2001 | last post by:
Hello friends, I want to connect http or https by taking url, username & password from user (if necessary )& then connect to download file from that source in console application. Can u help...
4
by: newladder | last post by:
Hi all, Iam struck with one of the problem with postgres. Please help me out.... Iam trying to connect to connect to postgres database on remote machine with the IP address 10.2.1.4. Iam unable...
1
by: ynyus75 | last post by:
Hey! I am unable to connect some of the services that I host from my laptop at home, such as SMTP and MySQL on port numbers 25 and 3306 respectively. But I am able to some services such as...
0
by: smokenlinks | last post by:
I am working on a script and i get this error Warning: fsockopen() : unable to connect to https://www.alertpay.com:443 (Unable to find the socket transport "https" - did you forget to enable it...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.