Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static string _BetFairLogin(string user, string pass)
- {
- string uri = "https://api.mountbet.com/v1.0/login";
- string appKey = Properties.Settings.Default.AppKey;
- string myParameters = String.Format("username={0}&password={1}", user, pass);
- var data = new { username = user, password = pass };
- var paramsJson = Newtonsoft.Json.JsonConvert.SerializeObject(data);
- WebClient client = new WebClient();
- client.Headers[HttpRequestHeader.ContentType] = "application/json";
- client.Headers[HttpRequestHeader.Accept] = "application/json";
- client.Headers["X-Application"] = appKey;
- string loginResponseStr = client.UploadString(uri, paramsJson);
- LoginResponse loginResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<LoginResponse>(loginResponseStr);
- if (loginResponse.Token != null)
- {
- return loginResponse.Token;
- }
- else
- {
- return null;
- }
- }
Add Comment
Please, Sign In to add comment