skip to Main Content

I hate writing UIs so I choose to use this older tech because I get a built-in graphical UI designer.

Here is what I am trying to do:
Process.Start("file:///F:/Dashboard%20Files/Open%20Issues.htm");

And this works when I run the build, seamlessly, but for some reason when I publish it I get this error in event viewer:
Exception message: The system cannot find the file specified

I do see this in the event logs message, perhaps someone has a one-liner to get around this:

Request URL:       http://investments.com/A00-Home.aspx
Request path:      /A00-Home.aspx
User host address: 10.XXX.XXX.XXX (local 10.* address)
User:
Is authenticated:  False

My thoughts are that I need to somehow put integrated authentication into the web.config file. Is this the issue?

Tried this:
Process.Start("file:///F:/Dashboard%20Files/Open%20Issues.htm");

Got this:
Exception message: The system cannot find the file specified

I tried adding this to the Web.config file and still got the same error.

<authentication mode="Windows" />    

2

Answers


  1. Chosen as BEST ANSWER

    The answer is that this is not possible, unless it is run as local host. Websites cannot interact with local files, and for good reason. Credit to @Albert D. Kallal and @topsail for explaining this.


  2. So, you have this:

    Process.Start("file:///F:/Dashboard%20Files/Open%20Issues.htm");
    

    You can’t use the above. You can start a process, but not one that has ANY UI output. The above is in effect a command line process, and would start a new program on your computer.

    In your case, this works, since your development computer IS ALSO the web server computer.

    The above is not really much different then executing this code:

    Markup:

            <asp:Button ID="Button1" runat="server" Text="test message"
                OnClick="Button1_Click"                
                />
    

    Code behind:

    using System.Windows.Forms;
    

    And the code stub:

        protected void Button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Test");
        }
    

    The result is now this:

    enter image description here

    This "seems" like the above works, but that message box is appearing on the web server computer, which also happens to be the SAME computer running the both the web server, the browser, and your code behind. So the message box is showing, but NOT though the browser.

    If you publish the above to a web server, then the end result would be this:

    enter image description here

    So, your message box will show, but of course will show on the web server!

    And the same issue exists with you starting a whole new separate process with process.start.

    process.start will launch Excel, word, or whatever, but will launch that program on the server, and thus of course the output of that process will appear on the web server sitting in some server room.

    I’ll try later today to post some additional possible solutions, but the above at least explains why attempting to shell out, or start a new process on a computer running a web server will not work, since starting such a process means a separate windows program, and one that any output will be sent to the server’s screen, and not sent through the server part running the web browser. Keep in mind that a web server is just a computer box. If I launch Excel, that does not THEN mean that launching word means the Excel screen see’s the output from Word. The same concept applies here with the web server. The web server can dish out pages to a end user, but running a PDF viewer, or some other command line prompt on that web server does not then send that output to the web server, and eventually down to client computers that the IIS web server is sending out web pages to.

    Thus, you of course can’t use process.start to run software on my computer, since if you could run software on my desktop computer when I visit your web site, then of course no one would visit your site due to security reasons, and worse yet, no one would use the internet due to security risks.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search