I need to (on user demand) run an admin process several times from my app. I would like for users to enter admin credentials only once - so I would have to somehow store the credentials.

However I heard it's not possible to do this because of the way that UAC is designed.

Any other suggestions?

有帮助吗?

解决方案

You can not store admin credentials. Instead, run your admin process once, and leave it elevated and running in the background in case you need to do more things. You can communicate with it via NamedPipes or sockets.

For an example of how you could use WCF to communicate, there is a very simple example here: http://bloggingabout.net/blogs/dennis/archive/2007/04/20/wcf-simple-example.aspx

You should probably create the WCF ServiceHost on the admin process.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top