通过 Win Store App 的代码为 webview 设置 cookie/headers [英] set cookies/headers for webview via code for Win Store App
问题描述
我想通过代码为我的 webview
设置 cookie.我知道在 Windows 手机中这是不可能的.但是现在可以在 Windows 8 中使用吗?有人可以指导我吗?
I want to set cookies for my webview
via the code. I know it was not possible in windows phone. But is it now possible in windows 8? Can anyone guide me?
替代选项:我可以在导航到 Windows 8 中的 URL 时传递标题吗?
Alternate Option: Can I pass Headers while navigating to a URL in windows 8?
在 Windows 手机中
In windows phone
Navigate(URL, [Flags,] [TargetFrameName,] [PostData,] [Headers])
在 Windows 8 中
In Windows 8
Navigate(Uri source)
推荐答案
抱歉,WebView 控件不会为您执行此操作.
Sorry but the WebView control won't do that for you.
您可以使用所需的标头创建自定义 WebRequest,然后使用 WebResponse 的内容调用 WebView.NavigateToString().
You can acomplish what you want creating a custom WebRequest with the desired headers, and then call WebView.NavigateToString() with the content of the WebResponse.
这篇关于通过 Win Store App 的代码为 webview 设置 cookie/headers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!