[url=http://msdn.microsoft.com/zh-cn/library/tkscy493(VS.80).aspx]MSDN 《trust 元素(ASP.NET 设置架构)》[/url]
[url=http://msdn.microsoft.com/en-us/library/ms998341.aspx]MSDN 《How To: Use Medium Trust in ASP.NET 2.0》[/url]
[url=http://www.netomatix.com/development/webcaspermissions.aspx]《Check Code Access Security Permissions Granted to your asp.net web application》[/url]
[h1]附录B[/h1]
辰 提供的文件下载方案:
protected override void OnInit(EventArgs e)
{
Response.ContentType = "application/octet-stream";
using (FileStream stream = File.Open(Server.MapPath("~/test.txt"), FileMode.Open))
{
BinaryWriter writer = new BinaryWriter(Response.OutputStream);
byte[] buffer = new byte[1024];
int l = 0;
while ((l = stream.Read(buffer, 0, buffer.Length)) > 0)
{
writer.Write(buffer, 0, l);
}
}
}