惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
雷峰网
雷峰网
博客园_首页
小众软件
小众软件
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
U
Unit 42
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 叶小钗

博客园 - N/A2011

Managing Hierarchical Data in MySQL php soapclient with wsse 转贴 MySQL Multiple Result Procs in PHP 转贴 jQuery Datepicker by Example 转贴 Using MySQL Stored Procedures with PHP mysql/mysqli/pdo php generate pdf open office (java) ant + emma + junit Copy all files recursively from one folder to another RecursiveFileFinder 转贴: 怎样找第一份工作 PerformanceCounter in .net Trace in .net Logger in .net 转贴: 傅立叶级数(Fourier Series) 推导 Encrypting and Decrypting in .net Access Control List in .net User and Data Security in .net Unmanaged code in .net
CAS in .net
N/A2011 · 2009-06-04 · via 博客园 - N/A2011

VB.NET:

Imports System.Security.Permissions
Imports System.IO<Assembly: UIPermission(SecurityAction.RequestOptional, _
Unrestricted:
=True)> 
<Assembly: FileIOPermissionAttribute(SecurityAction.RequestOptional, _
Read:
="C:\")> 
<Assembly: FileIOPermissionAttribute(SecurityAction.RequestRefuse, _
Read:
="C:\Windows\")> 
Module Module1Sub Main()
        Console.WriteLine(
"Reading one line of the boot.ini file:")
        
Dim sr As StreamReader = New StreamReader("C:\boot.ini")
        Console.WriteLine(
"First line of boot.ini: " + sr.ReadLine)
    
End Sub

End Module 

C#:

 using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Permissions;
using System.IO;

[assembly: UIPermission(SecurityAction.RequestOptional, Unrestricted 

= true)]
[assembly: FileIOPermissionAttribute(SecurityAction.RequestOptional, Read 
= @"C:\")]
[assembly: FileIOPermissionAttribute(SecurityAction.RequestRefuse, Read 
= @"C:\Windows\")]
namespace CASCS
{
    
class Program
    {
        
static void Main(string[] args)
        {
            Console.WriteLine(
"Reading one line of the boot.ini file:");
            StreamReader sr 
= new StreamReader(@"C:\boot.ini");
            Console.WriteLine(
"First line of boot.ini: " + sr.ReadLine());
        }
    }
}

RequestMinimum contains permissions must have, RequestOptional contains permissions might use and reject all that are not listed, and RequestRefuse reject all permissions listed.