2 Replies - 3766 Views - Last Post: 18 November 2009 - 05:47 PM Rate Topic: -----

#1 jpcsmit   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 26-September 09

Run EXE file that writes a file to the remote machine

Posted 17 November 2009 - 03:23 PM

I have an simple executable file that writes a file when run. I checked forums on how to run EXE in ASP.net and the one thing that worked is this link:
http://support.micro...kb;EN-US;889251

Though the EXE did run, it didn't write the file to the remote machine's drive. Even tried it to write file on the server itself but it didn't.

Please help me how to make it possible. Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Run EXE file that writes a file to the remote machine

#2 Jayman   User is offline

  • Student of Life
  • member icon

Reputation: 423
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Run EXE file that writes a file to the remote machine

Posted 17 November 2009 - 06:15 PM

I imagine that if you caught the errors the EXE threw to a text file you will probably find that you are getting some kind of File IO or write permission error. The reason is that by default the ASP.NET worker process does not have permission to write to a directory outside of the web application, by design it has a very limited permission set.

And since ASP.NET is spawning the process the EXE will inherit the worker processes permissions. You are going to have to use impersonation using a domain account that has the necessary permissions to write to a network drive.

Be sure to read all the warnings concerned with implementing impersonation as this can easily lead to some serious security issues.

Personally I do not recommend it because of the security risk, but its up to you.

As an alternative suggestion that is much safer. I would recommend using ASP.NET to write to a file within the web applications directory, thereby eliminating the need to give it more permission than it needs. Then create a Windows Service that monitors the folder that ASP.NET will write to using the FileSystemWatcher object to detect when a file has been created. You can specify which domain account the Windows Service will run under so that it has the necessary permissions to access the network drive.

Once it detects a new file, it can then write the file to the remote drive. This way if a user was able to compromise your web site, then they will not be able to access the remote drive, creating an even bigger security risk.
Was This Post Helpful? 0
  • +
  • -

#3 jpcsmit   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 26-September 09

Re: Run EXE file that writes a file to the remote machine

Posted 18 November 2009 - 05:47 PM

Thanks for the info Jayman. What's weird is I don't have any error message of write permission error. The exe just runs fine but didn't create the file.

I also have thought of your alternative suggestion, where the file would be written on the server then the webpage would just read and output the file. But the thing is, it also didn't write file on the web server. weird...how would i make it pop up error message for file io write error?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1