Exemple #1
0
 private void VerifyCodeBaseDiscovery(string codeBase)
 {
     if ((codeBase != null) && (string.Compare(codeBase, 0, "file:", 0, 5, StringComparison.OrdinalIgnoreCase) == 0))
     {
         URLString str = new URLString(codeBase, true);
         new FileIOPermission(FileIOPermissionAccess.PathDiscovery, str.GetFileName()).Demand();
     }
 }
Exemple #2
0
        internal static RuntimeAssembly InternalLoadAssemblyName(AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity, ref StackCrawlMark stackMark, bool forIntrospection, bool suppressSecurityChecks)
        {
            if (assemblyRef == null)
            {
                throw new ArgumentNullException("assemblyRef");
            }
            assemblyRef = (AssemblyName)assemblyRef.Clone();
            if (assemblySecurity != null)
            {
                if (!AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
                {
                    throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
                }
                if (!suppressSecurityChecks)
                {
                    new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
                }
            }
            string strA = VerifyCodeBase(assemblyRef.CodeBase);

            if ((strA != null) && !suppressSecurityChecks)
            {
                if (string.Compare(strA, 0, "file:", 0, 5, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    CreateWebPermission(assemblyRef.EscapedCodeBase).Demand();
                }
                else
                {
                    URLString str2 = new URLString(strA, true);
                    new FileIOPermission(FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read, str2.GetFileName()).Demand();
                }
            }
            return(nLoad(assemblyRef, strA, assemblySecurity, null, ref stackMark, true, forIntrospection, suppressSecurityChecks));
        }