-
-
Save prashantvc/d6e8cab1e242b9c22d64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net.Http; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Test | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
Console.WriteLine ("Hello World!"); | |
MainClass m = new MainClass (); | |
m.CreateSession (); | |
Console.ReadLine (); | |
} | |
public async Task CreateSession () | |
{ | |
using (var client = new HttpClient ()) { | |
var url = string.Format ("https://localhost/AuthService.svc/" + "ValidateUserNW"); | |
var json = "{\"Username\":\"jh\",\"Password\":\"kj\"}"; | |
HttpContent content = new StringContent (json, | |
Encoding.UTF8, | |
"application/json"); | |
try { | |
client.DefaultRequestHeaders.Add ("User-Agent", "Finder/1.0.0.0 (Android; Nexus 4 (KitKat) OS 4.4.2)"); | |
} catch (Exception e) { | |
Console.WriteLine (e); | |
} | |
// Need by service, don't remove | |
var resp = await client.PostAsync (url, content); | |
Console.WriteLine (resp); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment