473,804 Members | 4,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebRequest fails with HTTPS Exception: SecureChannelFa ilure

Hello,

we are implemting an application that uses a https
connection
for accessing a website. It is also possible to connect
via http.

With http every thing works fine. With https it is not
possible
to connect to the web site. The tunnel is established
without
an error, but it seems that the Credentials are ignored,
because
the server generates a not authorised error. The following
peace
of code is used for the connection.
webreq = (HttpWebRequest )WebRequest.Cre ate(sendstr);
webreq.Timeout = m_SocketTimeout ;
webreq.Credenti als = m_Credentials;
webreq.CookieCo ntainer = new CookieContainer ();
webreq.CookieCo ntainer.Add(m_C ookieCol);

webresp = (HttpWebRespons e)webreq.GetRes ponse();
getstream = webresp.GetResp onseStream();
sr = new StreamReader(ge tstream);
rc = sr.ReadToEnd();

If the above code is used via https the WebResponse
generates the
exception SecureChannelFa ilure.

Any help is wecome.

Thanks

Frank.
Nov 16 '05 #1
3 6893
Frank,

This is just a guess, but is it possible that you don't have the root
certificates on the machine updated?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Frank Schwarz" <an*******@disc ussions.microso ft.com> wrote in message
news:5d******** *************** *****@phx.gbl.. .
Hello,

we are implemting an application that uses a https
connection
for accessing a website. It is also possible to connect
via http.

With http every thing works fine. With https it is not
possible
to connect to the web site. The tunnel is established
without
an error, but it seems that the Credentials are ignored,
because
the server generates a not authorised error. The following
peace
of code is used for the connection.
webreq = (HttpWebRequest )WebRequest.Cre ate(sendstr);
webreq.Timeout = m_SocketTimeout ;
webreq.Credenti als = m_Credentials;
webreq.CookieCo ntainer = new CookieContainer ();
webreq.CookieCo ntainer.Add(m_C ookieCol);

webresp = (HttpWebRespons e)webreq.GetRes ponse();
getstream = webresp.GetResp onseStream();
sr = new StreamReader(ge tstream);
rc = sr.ReadToEnd();

If the above code is used via https the WebResponse
generates the
exception SecureChannelFa ilure.

Any help is wecome.

Thanks

Frank.

Nov 16 '05 #2
Nicholas Paldino [.NET/C# MVP] wrote:
Frank,

This is just a guess, but is it possible that you don't have the
root certificates on the machine updated?


Or maybe there's something wrong with the certificate and it is being
rejected by the BCL's default certificate policy?

--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e
Nov 16 '05 #3
Nicholas,

thanks for your reply.

I do not think that it is a problem with the certificate, because it is
possible
to access areas where no additional login is necessary. Only areas with an
additional username password access are rejected. The username and password
are copied using the Credentials. As it worked with Http, I think the
Credentials
might be ignored or not correcly sended.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Frank,

This is just a guess, but is it possible that you don't have the root
certificates on the machine updated?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Frank Schwarz" <an*******@disc ussions.microso ft.com> wrote in message
news:5d******** *************** *****@phx.gbl.. .
Hello,

we are implemting an application that uses a https
connection
for accessing a website. It is also possible to connect
via http.

With http every thing works fine. With https it is not
possible
to connect to the web site. The tunnel is established
without
an error, but it seems that the Credentials are ignored,
because
the server generates a not authorised error. The following
peace
of code is used for the connection.
webreq = (HttpWebRequest )WebRequest.Cre ate(sendstr);
webreq.Timeout = m_SocketTimeout ;
webreq.Credenti als = m_Credentials;
webreq.CookieCo ntainer = new CookieContainer ();
webreq.CookieCo ntainer.Add(m_C ookieCol);

webresp = (HttpWebRespons e)webreq.GetRes ponse();
getstream = webresp.GetResp onseStream();
sr = new StreamReader(ge tstream);
rc = sr.ReadToEnd();

If the above code is used via https the WebResponse
generates the
exception SecureChannelFa ilure.

Any help is wecome.

Thanks

Frank.


Nov 16 '05 #4

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

Similar topics

0
1762
by: Marcus | last post by:
Hi all, I have some code that downloads an XML tree from a web server. If there is a problem returning the requested XML tree from the server, it returns an XML tree with the error message in a 500 internal server error response. I want to get this error message, but WebRequest.GetResponse() throws an error because of the server error, so I can't get a reference to the response. Is there a way around this? Code follows below.
5
21033
by: mammothman42 | last post by:
Hi Sorry to be posting slabs of code, but i simply can't get this code to work. I continue to get error 405, method not allowed at req.GetRequestStream(). Can't for the life of me figure out why, i mean, of course POSTing is allowed, that's how the site submits the user data! WebRequest req = WebRequest.Create("https://www2.netbank.commbank.com.au/netbank/NetBank/scripts/cgiclnt.dll/CORE-Main%20Web/ND000_");
2
2576
by: Christian Pické | last post by:
Hi, I have to do a POST to an URI. I already figured out this code: WebRequest myRequest = WebRequest.Create("https://select.worldpay.com/wcc/purchase"); myRequest.Method = "POST";
2
4521
by: Tony Guidici | last post by:
I have been attempting to send an XML post to a ASPX page I created as a listener. On our Windows Server 2003 Web Edition server, I installed a test certificate from Thawte and can hit the page just fine from the browser. However, when I attempt to use the WebRequest object to post to the page, I get the folowing error: "The underlying connection was closed: Could not establish trust relationship with remote server." I used the...
2
1454
by: oliver.wulff | last post by:
Hi My ASP.NET application has to send https requests to other web servers quite often. I'd like to know how I should manage the connections? Does the method WebRequest.Create() reuses an existing https connection to the destination server or will a new one created for each call? Can several threads use the same instance returned by WebRequest.Create()? If yes, will the requests be serialized or will they be called in parallel? This is...
1
1167
by: Nelson R. | last post by:
Hi, i need to get some info from a website page that requires an certificate. Ive got the provided certificate installed in IE, and when accessing the website page, it shows a window to select the client certificate and then shows the page correctly. Im trying to do this by code (vs2003 C# aspnet), using webrequest.
4
7238
by: Terry | last post by:
Hello, I am trying to get a response for an .aspx page in my current project (same virtual directory) by using WebRequest.GetResponse but I keep getting a exception with "500 Internal server error" in the exception message. I am able to do this fine with another .aspx page that has no code-behind. The page that has code-behind throws the exception. What I am doing is getting the .aspx response, reading the stream, replacing
0
1813
by: jesper.hvid | last post by:
Hi. I've noticed, after moving some of our code to 2.0, that System.Net.WebRequest.Create(System.String) and System.Uri(System.String) no longer behave as they did in 1.1 framework. Example: string emailHttpPath =
3
9605
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. I'm trying to create a call to a web page to validate and register software. The code I'm using is: Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Dim WebRequest As HttpWebRequest Dim instance As HttpWebRequest =...
0
9589
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10593
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10329
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7626
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.