简体   繁体   中英

Process.Start not working on UAT for opening file

this works on dev as usual when I put it on UAT the code does something different. A PDF is saved on the server, the class then opens it up using the url of that file. The URL works fine if I paste it into a browser, but doesn't work from the code. Here's my code:

  Process.Start(openPath);

openPath will look like: "http://www.cbm360.net/test/temp/CBM360Report_1093750.pdf"

The file is there on the server, but it just won't open in the code. The code is inside a web method called using AJAX, if that makes any difference, I'm not sure.

Does anyone have any suggestions as to why this isn't working?

The Exception is:

 System.ComponentModel.Win32Exception: The system cannot find the file specified

Thanks!

Instead of pasting the URL into a browser (I assume this is on the server), try it directly from the command line on the server. Does it work now? Process.Start is not the same as navigating to a URL in the browser, it is more akin to running the URL from the command line. I am not sure what you are trying to achieve. Normally we would use a web request to get a pdf.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM