PDA

Click to See Complete Forum and Search --> : Web Browser Control..or..Right Click..View Source..File Save


ChrisJackson
Nov 19th, 1999, 02:34 AM
HI.

I am using a web browser control to access the Internet. It pulls up web pages just fine, but I need to save the HTML source code of the displayed page from my VB project.

Option 1
Does anyone know how to do this using the web browser control?

Option 2
The same thing can be accomplished by right clicking on the web page, selecting View Source and then saving the file. How do I get VB to automate these steps?

Option 3
A way to do this that I haven't thought of yet! (using the Internet Transfer Control is not an option due to security issues.)

Of course, the first option is the better, more efficient choice. I just can't figure out how to do it!

I would appreciate it if someone could shed light (and code..if available) on either of the options above.

Thanks in advance.

Chris

Juan Carlos Rey
Nov 19th, 1999, 08:47 AM
Just a silly idea:

Internet Explorer (the engine behind Web Browser Control) stores the source code in a temporary directory with fancy names (e.g. HK0503BF) located in Windows\Temporary Internet Files\Content.IE5\
Just try finding and saving it!

ChrisJackson
Nov 19th, 1999, 08:20 PM
Juan Carlos,

Thanks for your reply.

I've been researching getting the source code file from the Temporary Internet Files folder. The problem\concern I have with this method is I have to be sure that I am getting the right file (especially when IE assigns them cryptic names). Since this is going to be a process that cycles through many records, I am worried about the accuracy of this method.

Any more "silly ideas" from you, or anyone else reading this post, are welcome.

Thanks

Chris

------------------
CJ

Juan Carlos Rey
Nov 20th, 1999, 03:35 AM
Hi, Chris:
That silly weird name (QFQ907AH) is for the directory, the file name remains unchanged and it's the same of the page.

For ex. the complete path to this post in my machine is:

windows\temporary internet files\content.ie5\qfq907ah\010743.html

I can find it with Windows Explorer, but I was not able to look for it with DOS Dir 'cause my stupid P 166 hangs up when I try to go to DOS from Windows. I think VB would be able to find it, however.
Good Luck!

ChrisJackson
Nov 20th, 1999, 08:46 PM
Juan Carlos,

Thanks for your follow-up. I was able to locate the file.

This seems like the only way to access the source code with VB other than using the Internet Transfer Control (which is not an option due to security on the website). I am surprised that the Web Browser Control doesn't have a property that returns the source code sense it obviously has to use the source code to display the web page.

It shouldn't be so hard to do this!

Thanks again for your help.

Chris

------------------
CJ