2
Answers

start new process in newly opened window

open_door8

open_door8

10y
793
1
I have application which opens HTML document. You can edit the document with HTML editor.  Next, btnPreview opens a new window and shows changes you made in Internet Explorer (IE - default browser). 
 
Here is original code - works OK when you run from both - Visual Studio 2010 (http://localhost:50827/NCSite/MenuEditor.aspx) or via browser IE (http://localhost/NCSite/MenuEditor.aspx).
...
URL = Request.Url.Scheme + "://" + Request.Url.Host + appPath + URL;
ClientScriptManager cs = Page.ClientScript;
 
cs.RegisterStartupScript(this.GetType(), "NewWindow", "<script>window.open('" + URL + "', 'New')</script>");
...
 
Now I have a request to add two more buttons to preview in Google Chrome and Mozilla Firefox.
I used next code:
...
//for btnIE:
URL = Request.Url.Scheme + "://" + Request.Url.Host + appPath + URL;
Process.Start("iexplore", URL);
 
//for btnGC:
URL = Request.Url.Scheme + "://" + Request.Url.Host + appPath + URL;
Process.Start("chrome", URL);
 
//for btnFF:
URL = Request.Url.Scheme + "://" + Request.Url.Host + appPath + URL;
Process.Start("firefox", URL);
...
 
It works OK when you run from Visual Studio 2010 (http://localhost:50827/NCSite/MenuEditor.aspx) but when you run from btnIE, btnGC, or btnFF it simply replacing existing window and shows updated document via IE.  Processes for GC and FF not even started.
 
Is it any way to solve that issue?
 
Thanks,
dm
 
Answers (2)