0
我試圖在C#控制檯應用程序中使用JSON Web服務。 Web服務正在使用HTTP基本身份驗證。我無法訪問我的控制檯應用程序。如何從.NET控制檯調用JSON WebService
代碼示例...
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"https://0000.000.0.000:0000/hrms/rest/login");
request.Method = "POST";
request.ContentType = @"application/json";
//request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes("sharads:hrms123"));
HttpWebResponse resp = request.GetResponse() as HttpWebResponse;
你有什麼異常確切嗎? –
http://stackoverflow.com/questions/8270464/best-way-to-call-a-json-webservice-from-a-net-console –
你有沒有試過[json.net](http:// json。淨)。使事情變得更容易... – sc911