views:

55

answers:

2

For a regular .exe file i can always right click and select "run as..". How can i run a Click-Once application under different credentials in a similar way?

I am talking about the application itself, not the installer.

A: 

Are you talking about a one off process, or something that needs to happen every time your code is run on multiple computers? Because if you simply want to personally run a ClickOnce app with elevated permissions, its pretty simple. Click once apps reside at %LOCALAPPDATA%\Apps\2.0[ObfuscatedFolderName]. Simply find your app folder ( timestamp should be enough information ), then rightclick your EXE and run as admin.

If you want to do it in code, the easiest solution is probably to make a shell launcer application around your code, that requests elevated permissions in code. Here is such an example.

Serapth
Do you know if the location of the app may change after an auto-update?
Vitalik
What i am really trying to do is to run a click-once up under domain account from a computer that is not part of the domain (but on the same network).
Vitalik
I don't believe you can rely on the path staying consistent, no.
Serapth
Serapth
I deploy via shared folder
Vitalik
Also my guess both approaches will not perform auto-update since i am going against .exe directly.
Vitalik
+2  A: 

The answer really is no, you shouldn't do this. ClickOnce applications are installed under the user profile and belong only to that user. THey will not and do not work as an all-user installation.

Also note that if you double-click on the [exe] file (the location of which changes every time there is an update), it will not look for updates, it will not check the files to make sure they haven't been tampered with. In other words, it will not run as a ClickOnce application.

I also think passing the username and password in the query string is ill-advised because anybody running fiddler or charles or any other network traffic sniffer will be able to see the credentials.

RobinDotNet
I agree on sending password in URL. Don't even need a sniffer, any IIS log will have it.Can i run an installer under domain account then maybe?
Vitalik