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

推荐订阅源

P
Proofpoint News Feed
博客园_首页
WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
酷 壳 – CoolShell
酷 壳 – CoolShell
Y
Y Combinator Blog
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
G
Google Developers Blog
Last Week in AI
Last Week in AI

博客园 - 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.