FileLoadException when running app with Impersonate from network folder.



If I take the example c# code from the MSDN site:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemSecurityPrincipalWindowsIdentityClassImpersonateTopic.asp

and compile it into a console app, using vs 2005, I can run the app and
it works great.

Then I drag the app.exe from the bin/debug folder to another folder on
my hard drive, and double click the .exe. Still works great.

Then I drag this app.exe to a folder on the network and double click
the .exe.
Now I get a FileLoadException.

What do i need to do to avoid this exception?

Thanks,
Mike

.



Relevant Pages

  • Re: Moving a file from A to B fails with incorrect syntax error
    ... folder with the same attributes and permissions will move to the same ... destination folders. ... Try running a sample from a simple console app. ... but the error message i get is ...
    (microsoft.public.vc.mfc)
  • RE: Strange behavour of Process
    ... all exe are console apps that I think are written in Microsoft C (not ... Sub MainAs String) ... Dim fi As New FileInfo ... The console app will hang. ...
    (microsoft.public.dotnet.framework)
  • Migrating Console App To Windows Service
    ... I have created a small console app that creates a few custom objects - each ... responsible for monitoring a different folder on the local machine. ... Here is the P-Code for the current console app version ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Write to stdout
    ... >I'm currently testing a CGI interface and need to write lots of quick & ... >dirty test programs. ... My undersanding is that a VB EXE does not know that it is meant to be ... a console App, this requires a tweak in the header of the EXE ...
    (microsoft.public.vb.general.discussion)
  • Re: Write to stdout
    ... >>create a console app in VB that writes to stdout? ... > My undersanding is that a VB EXE does not know that it is meant to be ... > a console App, this requires a tweak in the header of the EXE ...
    (microsoft.public.vb.general.discussion)

Loading