» Http Error 401 and 403 trigger "Could not establish secure channel for SSL/TLS."
Http Error 401 and 403 trigger "Could not establish secure channel for SSL/TLS."
|September 15, 2014
Posted by forumadmin
So I am getting a very interesting error when I try to invoke my service using incorrect data:
“The underlying connection was closed: Could not establish secure channel for SSL/TLS.
The certificate is not valid, but that’s not the point, because the problem occurs whenever I throw Http Error 401 or 403, otherwise it works fine. How can I stop this error from occurring and return to getting errors 401 and 403?
Not sure if the code is going to be of any use, but here is for authentication and authorization:
public bool InitSecurity()
//Authentication first -> check who we are speaking to:
//If the authentication failed we return error 401 -> Unauthorized
this.HttpContext.Response.StatusCode = 401;
this.HttpContext.Response.AddHeader("WWW-Authenticate", "Basic realm=\"localhost\"");
//No point continuing executing code further;
//Now that we have checked their identity we can check whether they have the access to perfom the requested
//If the authorization failed we return error 403 -> Forbidden
this.HttpContext.Response.StatusCode = 403;
I forgot to add this is a fairly complex custom authentication mechanism triggered using IParameterInspector
More Related Questions
- Mutual authentication on c# .NET 4 server I developed a server application with C# .NET 4 , and I am meeting a problem when i try to connect to this server with a mutual authenticated SSL communication. It works well with a 1 way […]
- What is common practices for wrong ClientCredentials? I have WCF service hosted on local IIS under SSL.
It seems to be working with SL client. But I stuck on user authentication.
I have login screen with textboxes for user name and […]
- Adding WCF Service Reference with https endpoint My WCF service application works over http and https, however, when I add a service reference (with the https url) to it in my client, Visual Studio 2010 sets the endpoint in the config […]
- WCF Transport Security Using Client Certificates I've been working off the following URL's to try to accomplish WCF Transport Security using client certificates on my development machine (so my box is serving as the client and the […]
- How to implement HMAC Authentication in a RESTful WCF API We are building a RESTful API using WCF (currently .Net 3.5, but will be moving to .Net 4 soon). We have a functional framework in place, but it is currently unsecured. It will need to […]
- No client certificate CA names sent (setting up TLS one to one connection in IIS 8.5) I am setting up a web server that has 2 applications on it, one requires no authentication the other requires TLS authentication (one to one).
The issue I'm having is my TLS […]
- WCF SOAP call with both username token and client certificate I'm trying to get a call to a web service (not sure what the backend is written in) using both a username token (username/pwd) and a client certificate.
Short version: what combination of […]
- WCF DualHTTPBINDING Message security When using WSDUALHTTPBINDING with message security, is it recommended to use Transport security also [i.e SSL]? Maybe it depends on the scenario. In my case, both client and service are […]
- Specify SSL Protocol version to use for WSHttpBinding client connection Is it possible to specify the version of SSL Protocol to use when using a web service via WSHttpBinding?
I've been using a trace log to try and determine why my calls to a web service, […]
- IIS hosted WCF with SSL Certifcate I am new to WCF and WCF Security. I am trying to use a WCF service using SSL. There are lots of examples on the internet, but I am really confused. The issue is this:
In the IIS we can […]