This is useful when you need to know if a particular page has been viewed.
/// /// writes a gif image to the browser and closes the response object /// /// <param name="response">where to write the gif</param> /// <param name="absolutePath">where to read the gif</param> public static void WriteGif(System.Web.HttpResponse response, string absolutePath) { //TODO: cache images in hashmap with filename the key FileStream fileStream; long length = 0;
fileStream = new FileStream(absolutePath, FileMode.Open, FileAccess.Read); length = fileStream.Length;
byte[] bBuffer = new byte[(int)length]; fileStream.Read(bBuffer, 0, (int)length); fileStream.Close();
response.ClearContent(); response.ContentType = "image/gif"; response.BinaryWrite(bBuffer); response.End(); }
|
No responses found. Be the first to respond and make money from revenue sharing program.
|