Log in with code
Hans Karlsen (talk | contribs) (Created page with " a") |
Hans Karlsen (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
[[ | |||
private void Button_Click_1(object sender, RoutedEventArgs e) | |||
{ | |||
var client = new HttpClient(); | |||
var loginform = client.GetAsync("https://raptor3ny/TurnkeyWebAppGeneric/Account/Login").Result; | |||
var loginformcontent = loginform.Content.ReadAsStringAsync().Result; | |||
var part1=loginformcontent.Substring(loginformcontent.IndexOf("<input name=\"__RequestVerificationToken\""), 1000); | |||
part1 = part1.Substring(part1.IndexOf("value=")); | |||
part1 = part1.Substring(part1.IndexOf('"') + 1); | |||
part1 = part1.Substring(0,part1.IndexOf('"')); | |||
var content = new MultipartFormDataContent(); | |||
content.Add(new StringContent("hans@karlsen.se"), "EMail"); | |||
content.Add(new StringContent("123456"), "Password"); | |||
content.Add(new StringContent("false"), "RememberMe"); | |||
content.Add(new StringContent(part1), "__RequestVerificationToken"); | |||
var result = client.PostAsync("https://raptor3ny/TurnkeyWebAppGeneric/Account/Login", content).Result; | |||
if (result.StatusCode == System.Net.HttpStatusCode.OK) | |||
{ | |||
// Login successfull | |||
} | |||
} | |||
]] |
Revision as of 11:06, 11 June 2017
[[
private void Button_Click_1(object sender, RoutedEventArgs e) { var client = new HttpClient();
var loginform = client.GetAsync("https://raptor3ny/TurnkeyWebAppGeneric/Account/Login").Result; var loginformcontent = loginform.Content.ReadAsStringAsync().Result; var part1=loginformcontent.Substring(loginformcontent.IndexOf("<input name=\"__RequestVerificationToken\""), 1000); part1 = part1.Substring(part1.IndexOf("value=")); part1 = part1.Substring(part1.IndexOf('"') + 1); part1 = part1.Substring(0,part1.IndexOf('"')); var content = new MultipartFormDataContent(); content.Add(new StringContent("hans@karlsen.se"), "EMail"); content.Add(new StringContent("123456"), "Password"); content.Add(new StringContent("false"), "RememberMe"); content.Add(new StringContent(part1), "__RequestVerificationToken"); var result = client.PostAsync("https://raptor3ny/TurnkeyWebAppGeneric/Account/Login", content).Result; if (result.StatusCode == System.Net.HttpStatusCode.OK) { // Login successfull } }
]]
This page was edited more than 9 months ago on 03/26/2024. What links here