使用Thinktecture获取会话令牌的方法是http://www.website.com/api/token。但是我正在获取和错误“响应状态代码并不表示成功: 404 (未找到)”。使用浏览器时,以及下面的代码。
var credentials = new NetworkCredential("admin", "password");
var handler = new HttpClientHandler { Credentials = credentials };
var client = new HttpClient(handler) {BaseAddress = new Uri("http://www.website.com/")};
var response = await client.GetAsync("api/token");
response.EnsureSuccessStatusCode(); // Throw on error code.
var accountInformationJson = await response.Content.ReadAsStringAsync();但是,当我使用CURL -用户管理:password-get http://www.website.com/api/token来尝试时
我似乎要回到会话json罚款{ "access_token":access_token "expires_in":36000.0 }
知道为什么会发生这种事吗?
发布于 2013-08-16 15:39:43
我不得不打电话给http://www.website.com/api/controller/token以获得会话令牌。
https://stackoverflow.com/questions/18263748
复制相似问题