如何从 WPF 应用程序向默认浏览器发送 Web 请求?
我正在开发一个 WPF 应用程序,它是网站的桌面对应部分。
这个想法是应用程序应该具有与网站相同的功能,但对于应用程序的第一个版本,并非所有功能都可用,因此我想在尚不可用的功能上添加一个链接,希望当用户单击该链接时,我想将他们带到该网站,即该功能的页面。
到目前为止,我可以毫无困难地做到这一点,使用 shell 命令我可以打开默认浏览器并将请求发送到网站上我需要的资源。
现在,棘手的部分是我想使用用户在桌面应用程序中使用的凭据来对网站进行身份验证,因此用户不必再次进行身份验证,我正在考虑发送在标头中加密的凭据,但是我不知道如何做到这一点,如何将标头从我的应用程序发送到网络浏览器。
关于如何做到这一点有什么想法吗?
顺便说一句,该网站正在使用表单身份验证。
谢谢。
I'm working in a WPF application which is the desktop counter-part of a website.
The idea is that the application should have the same functionalities that the website has, but for the first release of the application not all features would be available, because of this I want to put a link on the features that are not available yet and hopefully when the user click on that link I want to take them to the website, to the page for that functionality.
So far, I can do this with no trouble, using the shell command I can open the default browser and send the request to the resource I need on the website.
Now, the tricky part is that I want to use the credentials that the user used in the desktop application to authenticate with the website, so the user doesn't have to authenticate again, I was thinking in sending the credentials encrypted in a header but I don't know how can I do this, how can I send the header to the web browser from my application.
Any idea on how to do this?
BTW the website is using Forms Authentication.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试将表单身份验证 cookie 作为网络请求的一部分传递。
尝试此链接
You could try passing your forms authentication cookie as part of the webrequest.
try this link