使用 RestSharp 通过代理进行 Web 请求 [英] Web Request through Proxy using RestSharp

查看:59
本文介绍了使用 RestSharp 通过代理进行 Web 请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 Windows phone 7 上的代理发出 webrequest.据我所知,Compact Framework 不包括为 HttpWebRequest 对象配置代理.我尝试使用 RestSharp 但 RestClient 也不允许这样做.我还尝试在本地计算机上配置 Internet 选项以使用代理,希望相同的选项适用于我的 Windows Phone 模拟器.那没有用.你有什么想法吗?

I'm trying to make a webrequest through a proxy on Windows phone 7. From what I can see the Compact Framework does not include the configuring of a proxy for the HttpWebRequest object. I tried using RestSharp but the RestClient also does not allow this. I've also tried configuring the Internet Options on my local machine to use a proxy, hopping that the same options will apply on my Windows Phone Emulator. That didn't work. Do you have any ideas?

推荐答案

在 Web.config 的配置"部分下添加:

Under "configuration" section in Web.config add this:

<system.net>
    <defaultProxy enabled="true" useDefaultCredentials="true"></defaultProxy>
</system.net>

(有关更多信息 - MSDN- defaultProxy 元素(网络设置))

(for more more info - MSDN - defaultProxy Element (Network Settings))

这篇关于使用 RestSharp 通过代理进行 Web 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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