var client = new RestClient("https://test.salesforce.com/services/oauth2/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.Parameters.Clear();
request.AddParameter("grant_type", "password");
request.AddParameter("username", userName);
request.AddParameter("password", password);
request.AddParameter("client_id", clientID);
request.AddParameter("client_secret", clientSecret);
response = client.Execute(request);
</pre>
<pre class="lang-cs prettyprint prettyprinted" style=", " , " , " , " , monospace, sans-serif; Bitstream Vera Sans Mono" Courier New" DejaVu Sans Mono" Liberation Mono" Lucida Console" border-radius: 3px; border: 0px; box-sizing: inherit; color: rgb(36, 39, 41); font-family: Consolas, Menlo, Monaco, " font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px 8px; vertical-align: baseline; width: auto;">
but getting error -
</pre>
<pre class="lang-cs prettyprint prettyprinted" style="border-radius: 3px; border: 0px; box-sizing: inherit; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px 8px; vertical-align: baseline; width: auto;">
The SSL connection could not be established, see inner exception. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host
</pre>
<pre class="lang-cs prettyprint prettyprinted" style="border-radius: 3px; border: 0px; box-sizing: inherit; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px 8px; vertical-align: baseline; width: auto;">
Anyone can help me with this?
</pre>