HttpClient HttpResponseMessage 地址/URI [英] HttpClient HttpResponseMessage Address / URI

查看:40
本文介绍了HttpClient HttpResponseMessage 地址/URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 C# WinRT 应用程序,它向网络服务器发出 POST 和 GET 请求.

I am developing a C# WinRT application that makes POST and GET requests to a webserver.

有谁知道在使用 HttpClient 对象时是否有办法获取响应 URI/地址?.

Does anyone know if there is a way to get the Response URI / Address when using a HttpClient object?.

如果我使用 HttpWebRequest/HttpWebResponse 类,那么我可以获取此信息(通过 HttpWebResponse 中的 ResponseUri 属性),但我不知道如何使用 HttpClient/HttpResponseMessage 类获取它.

If I use the HttpWebRequest / HttpWebResponse classes, then I can get this information (via the ResponseUri property in HttpWebResponse), but I don't see how to obtain it using the HttpClient / HttpResponseMessage classes.

谢谢

推荐答案

这已经两年了,但我刚刚带着完全相同的愿望遇到了这个问题,并在 评论 @PeterRitchie,所以我正在复制它以供将来的访问者使用.

This is two years old, but I just came across this question with the exact same desire, and it was answered in a comment by @PeterRitchie, so I am copying that for future visitors.

我认为您可以从 HttpResponseMessage.RequestMessage.RequestUri 获得重定向的 UI

I think you can get the redirected UI from HttpResponseMessage.RequestMessage.RequestUri

这篇关于HttpClient HttpResponseMessage 地址/URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆