I'm developing a class library to be used by several other applications and what I need is for the applications to run the code from the external class library with administrator privileges. I don't want to force every application to require administrator privileges by default and I know that once an application has been started it can not request administrator privileges and so my solution must involve starting a new process or creating a new application domain. I need help with the code because I don’t understand those concepts very well. I wrote some code below to demonstrate what I'm thinking.
// This method is inside my application
private void ApplicationMethod(bool runExternal)
{
if (runExternal)
{
// Create new process/appdomain and then run ExternalMethod.
// The string returned by ExternalMethod needs to be stored.
}
}
// This method is inside my external class library
private string ExternalMethod()
{
string externalString = string.Empty;
// Do work on externalString and then return it.
return externalString;
}
I would really appreciate demostration code based on what I wrote above.