WebRequest fails with HTTPS Exception: SecureChannelFailure

F

Frank Schwarz

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.Create(sendstr);
webreq.Timeout = m_SocketTimeout;
webreq.Credentials = m_Credentials;
webreq.CookieContainer = new CookieContainer();
webreq.CookieContainer.Add(m_CookieCol);

webresp = (HttpWebResponse)webreq.GetResponse();
getstream = webresp.GetResponseStream();
sr = new StreamReader(getstream);
rc = sr.ReadToEnd();

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

Any help is wecome.

Thanks

Frank.
 
N

Nicholas Paldino [.NET/C# MVP]

Frank,

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

Joerg Jooss

Nicholas said:
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?
 
G

Guest

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 said:
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]
- (e-mail address removed)

Frank Schwarz said:
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.Create(sendstr);
webreq.Timeout = m_SocketTimeout;
webreq.Credentials = m_Credentials;
webreq.CookieContainer = new CookieContainer();
webreq.CookieContainer.Add(m_CookieCol);

webresp = (HttpWebResponse)webreq.GetResponse();
getstream = webresp.GetResponseStream();
sr = new StreamReader(getstream);
rc = sr.ReadToEnd();

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

Any help is wecome.

Thanks

Frank.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top