s.s. s.s. - 1 year ago 120
C# Question

open PDF file from cross domain

I would like to open PDF file in a new window on the browser from java script.

But i can't use

because the file located on cross domain.
I tried do it via controller by
function, and nothing happened

var p = new Process();
p.StartInfo = new ProcessStartInfo(url);
p.StartInfo.WorkingDirectory = Path.GetDirectoryName(url);

(because of my chrome version?)
does anyone have good idea for me??
Thanks a lot!

Answer Source

If you put the file on your program dirctory then you can use this code

string path = AppDomain.CurrentDomain.BaseDirectory.ToString() + "YourPDF";

and then ou do this

var p = new Process();
        p.StartInfo = new ProcessStartInfo(path);
        p.StartInfo.WorkingDirectory = Path.GetDirectoryName(path);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download