Chrome - File not found

I have an application make it on VB.NET; this application have a couple of buttons that generate an HTML file

Dim PathX As String = Application.StartupPath & "\Web.html"
Dim XWriter As New StreamWriter(PathX)
XWriter.Write(WebX)
XWriter.Flush()
XWriter.Close()

Dim sInfo As New ProcessStartInfo(PathX)
Process.Start(sInfo)
System.Threading.Thread.Sleep(3000)
File.Delete(PathX)

It runs OK on all Web Browsers on 32 bits Win XP OS but on Win7 32bits doesn't work if the default browser is Chrome, it's say "File not found".

On Win XP, if I have Windows Explorer opened, I can see how the file appear a disappear 3 seconds after; On Win7 I can't see it but it works fine with IE so I assume that the file is being created.

In Chrome the navigation bar the file address is something like

file:///C:/Program%20Files/

In IE or Firefox

file:///C:/Program Files/

Now I move the executable to another directory with a single name and works Ok.

Plus, in another machine with the same processor(i5) it works ok even if the executable is in file:///C:/Program Files/

I came from here How I can get data after make a POST to an external HTTPS Web Page?

Answers


You are attempting to view the file by way of the file associations. Instead you need to use the executable file of the application and append the name of your html file as an argument.

I don't do much VB any more but I can point you to a good example:

http://www.dotnetperls.com/process-start-vbnet

Scroll down to the example for Microsoft Word .. ignore the ones that precede it. The Word example shown is using the ms word executable, explicitly.

You'll have to replace it with chrome.exe, wherever it's at on your PC.


Need Your Help

Simple Javascript highlighting in a text area?

javascript html

I have two simple textareas where in i want to highlight the javascript code being written.

windows driver development

windows driver device-driver msdn ndis

I am new to windows driver development, so please bear with me if my question is being too stupid. Well, I am not sure why, as MSDN suggested and also the way I perceived, the host computer, e.g