如何使用C#应用程序中的会话信息打开浏览器

时间:2022-11-21 07:37:27

I have an application that connects to a web server, requests some pages and process them. While doing the work the application authenticates with the server and some stuff is stored at the cookies that identifies the current session.

我有一个连接到Web服务器的应用程序,请求一些页面并处理它们。在完成工作时,应用程序通过服务器进行身份验证,并将一些内容存储在标识当前会话的cookie中。

I need to open a browser to that site from the application using the same session. Is there a way to do this?

我需要使用相同的会话从应用程序打开该站点的浏览器。有没有办法做到这一点?

I currently work with the server using WebRequest and WebResponse and putting on all the WebRequests the cookies I received on the WebResponse.

我目前使用WebRequest和WebResponse与服务器一起工作,并将我在WebResponse上收到的cookie放在所有WebRequests上。

Thanks.

1 个解决方案

#1


1  

Utilize the Web Browser control

利用Web浏览器控件

http://msdn.microsoft.com/en-us/library/w290k23d.aspx

Processing the HTML content directly will be best with the HTML agility pack:

使用HTML敏捷包时,最好直接处理HTML内容:

http://htmlagilitypack.codeplex.com/

#1


1  

Utilize the Web Browser control

利用Web浏览器控件

http://msdn.microsoft.com/en-us/library/w290k23d.aspx

Processing the HTML content directly will be best with the HTML agility pack:

使用HTML敏捷包时,最好直接处理HTML内容:

http://htmlagilitypack.codeplex.com/