Search code examples
asp.netasp.net-mvciishostingmedium-trust

Can I run a new process from a medium-trust ASP.NET application?


I'm building an ASP.NET MVC site where I want to use OpenSTV to conduct polls. To run results through OpenSTV, I'd have to run the executable. Is that allowed from a medium-trust ASP.NET application?


Solution

  • You can't instantiate a System.Diagnostics.Process object unless you're running at FullTrust.

    If you examine the attributes decorating the class you'll see the demand for FullTrust:

    Process Class (MSDN)

    [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
    [HostProtectionAttribute(SecurityAction.LinkDemand, 
            SharedState = true, Synchronization = true, 
        ExternalProcessMgmt = true, SelfAffectingProcessMgmt = true)]
    [PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
    public class Process : Component