public void ProcessRequest HttpContext context context Response Clear

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
public void ProcessRequest(HttpContext context) {
context.Response.Clear();
if(!string.IsNullOrEmpty(context.Request.QueryString["flash"])) {
context.Response.ContentType = "application/x-shockwave-flash";
context.Response.BinaryWrite(GetByteFile("~/Files/FlashClocks", context));
}
context.Response.End();
}
byte[] GetByteFile(string filePath, HttpContext context) {
byte[] bytes;
using(Stream fileStream = File.OpenRead(context.Server.MapPath(filePath))) {
bytes = new byte[fileStream.Length];
for(int i = 0; i < bytes.Length; i++) {
bytes[i] = (byte)fileStream.ReadByte();
}
}
return bytes;
}