It looks like you're new here. If you want to get involved, click one of these buttons!
var apikey = "XXX";
var rqtoken = "XXX";
var apisecretkey = "XXX";
var checksum = "";
Byte[] byteArray = Encoding.UTF8.GetBytes(apikey + rqtoken + apisecretkey);
SHA256 myHash = SHA256Managed.Create();
Byte[] hashedByteArray = myHash.ComputeHash(byteArray);
StringBuilder Sb = new StringBuilder();
foreach (Byte b in hashedByteArray)
Sb.Append(b.ToString("x2"));
string checksumString = Sb.ToString();
string url = "https://api.kite.trade/session/token";
var postData = "api_key=" + apikey + "&request_token=" + rqtoken + "&checksum=" + checksumString;
byte[] data = Encoding.UTF8.GetBytes(postData);// Encoding.ASCII.GetBytes(postData);
try
{
var request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/json; charset=UTF-8";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
Response.Write(responseString);
}
catch (Exception ex)
{
Response.Write(ex);
}
You can check out this thread.