开发者

.NET: Transfering session from HttpWebRequest to WebBrowser and getting full JS, CSS path

I have the following problem. I am using HttpWebRequest Class to send a post request. This post request is actually a portion of a XML file, coded before the transmission with Base64. The XML file is sent, so that server can create a formatted page in the browser, which user with appropriate certificate can then sign and deposit on server. I am sending it to a SSL Certificate Authentication secured site so it means I have a client certificate added with the HttpWebRequest.ClientCertificates Property to an instance of HttpWebRequest. I also have CookieContainer added, because the site gives a response back.

Now I get the response back as plain string (formatted document). It actually contains source code of the html response. Now I use WebBrowser to display the response back to user. The problem is, that the site uses relative addressing for javascript and css, so the WebBrowser does not get the styles and functionality supported by javascript libraries.

  1. Problem: So the first problem that I need to solve it, is, to somehow show the WebBrowser the URL address of the page, where it should actually be, so that the CSS and JS files will be available. I tried that with WebBrowser.Url Property, but with no success. I can only say that it has to point to the first page, where user comes after authentication, because all the CSS and JS files are contained inside folder /GUI. Maybe it did not work, because the URL address has to be assigned before the WebBrowser is loaded with 开发者_JAVA百科actual html file?
  2. Problem: Because the user needs to sign the document (that is done with the help of his private key + applet, that is ran from the server) I need to have a session from the HttpWebRequest, that I made to send the post. That is because the post that was sent to the server and is now returned as a formatted page is only valid in this session. It means it is lost after the session is over. That is why I have to transfer somehow the session from HttpWebRequest to WebBrowser.

I am using IED Visual Studio 2010, programming language C# and .NET FrameWork 3.5

Thanks in advance for any help!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜