cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1746
Views
0
Helpful
1
Replies

The request was aborted: Could not create SSL/TLS secure channel.

Raman2712
Level 1
Level 1

when we call rest api "Https://IPAddress/ers/config/guestuser/"

our code is 

 

String credidentials = ISE_Username + ":" + ISE_Password;
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(destinationUrl);
request.Method = "POST";
request.ContentType = "application/vnd.com.cisco.ise.identity.guestuser.2.0+xml";
request.Accept = "application/vnd.com.cisco.ise.identity.guestuser.2.0+xml";
String authCode = Convert.ToBase64String(Encoding.Default.GetBytes(credidentials));
request.Headers.Add("Authorization", "Basic " + authCode);

byte[] bytes;
bytes = System.Text.Encoding.UTF8.GetBytes(requestXml);
request.ContentLength = bytes.Length;

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });

Stream requestStream = request.GetRequestStream();
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Close();

using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
if (response.StatusCode == HttpStatusCode.Created)
{
Stream responseStream = response.GetResponseStream();
String responseStr = new StreamReader(responseStream).ReadToEnd();
// TempData["AccountCreatedMsg"] = true;
return responseStr;
}
else
{
// TempData["AccountCreatedMsg"] = false;
// TempData["ResponseCode"] = response.StatusCode;
}
}
}
catch (System.Exception ex)
{
Common.Log("Error in ISE : Message : " + Convert.ToString(ex.Message));
Common.Log("Error in ISE : Inner Ex : " + Convert.ToString(ex.InnerException));
}

We are getting below error : " The request was aborted: Could not create SSL/TLS secure channel." 

 

Please suggest. 

1 Reply 1

Dennis Mink
VIP Alumni
VIP Alumni

can you capture the transaction using wireshark to see what TLS negotiation takes place?

Please remember to rate useful posts, by clicking on the stars below.