httpclienthttpresponsemessage地址 /uri

问题描述 投票:0回答:1
如果我使用httpwebrequest / httpwebresponse类,那么我可以获取此信息(通过httpwebresponse中的Responseuri属性),但是我看不到如何使用HTTPCLCLIENT / HTTPCLESPONSEMESSAGE类获取它。 thanks

这已经两岁了,但是我只是以完全相同的愿望遇到了这个问题,并且在

@peterritchie

中回答了这一问题,所以我正在为未来的访客复制。

我认为您可以从httpresponsemessage.requestmessage.requesturi
c# httpclient windows-runtime .net-4.5
1个回答
23
投票

我相信您想要的是: HttpResponseMessage response = await httpClient.GetAsync(uri); if (response.Headers.Location == new Uri(some_uri_string)) { return true; }

我意识到这一反应已经晚了十多年,但是我想我会回答的。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.