网页浏览器导航用户代理 [英] Webbrowser navigate user agent
问题描述
我试图用follwing code,迫使用户代理在我的应用程序的网页浏览器。
I am trying to use the follwing code to force user agent for the webbrowser in my app.
webBrowser.Navigate("http://localhost/run.php", null, null, "User-Agent: Here Put The User Agent");
不过VS不会接受这个code,给我的错误。
However VS wont accept this code, giving me error.
没有过载方法'导航'需要4个参数
No overload for method 'Navigate' takes 4 arguments
我是什么失踪?
推荐答案
据的这个和<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.navigatetostring%28v=VS.95%29.aspx\"相对=nofollow>这没有导航
- 所以VS是正确的... code你展会将与.NET 4中,但无法正常工作与Silverlight。
According to this and this there is no Navigate
with more than one parameter available in Silverlight - so VS is right... the code you show would work with .NET 4 but not with Silverlight.
我没有看到一个选项来设置任何头中的Silverlight的 web浏览器
控制,所以我会怀疑你想要什么是不可能与Silverlight根据...在你的用例有可能使用 WebClient的和/或的 HttpWebRequest的来实现你想要的(请注意这些不呈现!)。
I don't see an option to set any header in the Silverlight WebBrowser
control so I would suspect that what you want to is not possible with Silverlight... depending on your usecase it might be possible to use WebClient and/or HttpWebRequest to achieve what you want (BEWARE these don't render!).
这篇关于网页浏览器导航用户代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!