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

推荐订阅源

The Last Watchdog
The Last Watchdog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 热门话题
G
GRAHAM CLULEY
S
Schneier on Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Recorded Future
Recorded Future
I
Intezer
云风的 BLOG
云风的 BLOG
博客园 - Franky
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
T
Tenable Blog
The Hacker News
The Hacker News
T
The Blog of Author Tim Ferriss
Attack and Defense Labs
Attack and Defense Labs
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News and Events Feed by Topic
有赞技术团队
有赞技术团队
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
N
News and Events Feed by Topic
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
The Cloudflare Blog
Webroot Blog
Webroot Blog
W
WeLiveSecurity
H
Heimdal Security Blog
博客园 - 三生石上(FineUI控件)
V
Vulnerabilities – Threatpost
G
Google Developers Blog
O
OpenAI News
V
V2EX
罗磊的独立博客
博客园_首页
N
News | PayPal Newsroom
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
TaoSecurity Blog
TaoSecurity Blog
Cloudbric
Cloudbric
H
Hacker News: Front Page
博客园 - 叶小钗
T
Tor Project blog
AI
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.