我试图消耗第三方的服务:
var context = new DataSource(new Uri("http://api.olr.com/Service.svc"));
context.Credentials = new NetworkCredential("username", "password", "http://api.olr.com/Service.svc");
var agents = from a in context.Agents
select a;
tbResponse.Text = agents.FirstOrDefault().ToString();
而后退:
<div class="content-container"><fieldset>
<h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
<h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>
</fieldset></div>
</div>
我试图利用浏览器获得服务,并正在工作。
下面线的第三个参数是领域。 哪些领域? 该处的午餐与否?
context.Credentials = new NetworkCredential("username", "password", "http://api.olr.com/Service.svc");