.NET Framework Developer Center > .NET Development Forums > .NET Framework Networking and Communication > Installing to a network share and avoiding a SecurityException
Ask a questionAsk a question
 

QuestionInstalling to a network share and avoiding a SecurityException

  • Saturday, February 09, 2008 5:10 PMColin Newell Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    When you run a .net 2.0 program from a network share you have less trust by default and I understand that.  It's possible to manually correct the situation by setting your security policy but I'm wondering what the etiquette is when installing?

     

    If the person is installing to a network share they presumably want to run it from the network share so would it be acceptable for the installer to grant the assemblies the trust they need?

     

    If that is the case what is the best way to do so?  Can you use the caspol tool or do you need to use an API and do it programatically?

     

     

    Colin.

All Replies

  • Tuesday, February 12, 2008 6:53 AMChunsheng TangMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    >>If the person is installing to a network share they presumably want to run it from the network share so would it be acceptable for the installer to grant the assemblies the trust they need?

     

    So you have already installed the application from a network share but it does not have necessary permissions, right? If that's the case you can grant the necessary permissions to the assembly as demonstrated in the following article about CAS:

      http://www.codeproject.com/KB/security/UB_CAS_NET.aspx

     

    The needed permissions of an assembly can be fetched as follows:

      http://support.microsoft.com/kb/815170

     

    Or you can increase the trust level of the assembly with the caspol.exe or the UI of it:

      http://msdn2.microsoft.com/en-us/library/2bc0cxhc(vs.80).aspx

     

    Best Regards

    Chunsheng Tang

     

  • Tuesday, February 12, 2008 9:08 AMColin Newell Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    Thanks for the links to those very good looking articles but I'm really trying to ask whether I should try to adjust the policy from an installer.  I'm torn, in some ways I don't want to mess with someone's security just because they ran my installer but at the same time if they are installing to a share they presumably want it to work from there so I should make it just work.

     

     

    Colin.