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

推荐订阅源

雷峰网
雷峰网
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
L
LangChain Blog
云风的 BLOG
云风的 BLOG
Jina AI
Jina AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
InfoQ
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
小众软件
小众软件
量子位
The GitHub Blog
The GitHub 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.