C# - Could not create SSL/TLS secure channel - Authentication Issues

I am writing code and implementing the code sample in the below url from Silicon Expert.

https://www.siliconexpert.com/apidocs/content/list-part-search

The sample code produced error:  "The request was aborted: Could not create SSL/TLS secure channel."

Searching I found that the below code should be implemented.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(AllwaysGoodCertificate);

Open in new window

Below is the full example.  
String username = "MyUserName";
String password = "MyPassword";

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(AllwaysGoodCertificate);

string url = "https://app.siliconexpert.com/SearchService/search/authenticateUser?login=" + username + "&apiKey=" + password;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Credentials = CredentialCache.DefaultCredentials;
CookieContainer cookieContainer = request.CookieContainer = new CookieContainer();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
String searchUrl = "https://app.siliconexpert.com/SearchService/search/xref?parts=[{\"partNumber\":\"bav99\"}]&crossType=B";
request = (HttpWebRequest)WebRequest.Create(searchUrl);
request.CookieContainer = cookieContainer;
response = (HttpWebResponse)request.GetResponse();
String results = new System.IO.StreamReader(response.GetResponseStream(), ASCIIEncoding.ASCII).ReadToEnd();
Console.WriteLine(results);
Console.ReadLine();

Open in new window

I am receiving

<?xml version="1.0" encoding="UTF-8"?><ServiceResult><Status><Code>1</Code><Message>Invalid User Name Or Password</Message><Success>false</Success></Status></ServiceResult>

Yet, when I log into the site and perform a search there is no issue.

Anyone see anything that I'm missing?  Want to check to see if it is the code or the site.
LVL 2
CipherISAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chinmay PatelChief Technical NinjaCommented:
Hi CipherIS,

Which version of .Net Framework your app is using?

Regards,
Chinmay.
0
CipherISAuthor Commented:
Framework I'm using is 4.5.  

I found the issue.  Apparently, another login is needed for the API.  Waiting for those credentials and then how it goes.
0
Kyle AbrahamsSenior .Net DeveloperCommented:
I would also remove  SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls as they are both already hacked.  If you end up transmitting with either of those protocols the information is public.
0
CipherISAuthor Commented:
The website requires different credentials to use the API.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.