How to specify user credentials for a click-once application?

前端 未结 3 1350
夕颜
夕颜 2021-02-03 11:08

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 talki

3条回答
  •  广开言路
    2021-02-03 11:45

    This is actually possible, you just need to do it in two steps. First you'll need to launch ClickOnce (dfsvc.exe) as the user you are trying to impersonate and then you can launch the deploy application using rundll32, something like this:

    (From the command line)

    1.- Click once:

    runas /user:domain\user "c:\Windows\Microsoft.NET\Framework\v4.0.30319\dfsvc.exe"
    

    2.- Launch app:

    runas /user:domain\user "rundll32 c:\Windows\System32\dfshim.dll,ShOpenVerbApplication http://someurl.com/tool.application"
    

    Note that you only need to run dfsvc.exe once if you need to launch multiple apps and it will go away after a while once you close all your impersonated click once applications.

提交回复
热议问题