123.aspx
<%@ Page Language="c#" ContentType="image/gif" Codebehind="14.aspx.cs" AutoEventWireup="false" %>
<%@ Import Namespace="stevenator.components" %>
<%@ OutputCache Duration="100" VaryByParam="none" %>
<script language="c#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
HTTPImage myHTTPImage = new HTTPImage();
myHTTPImage.outputImageViaHTTP("/010.gif", this.Response, this.Server);
}
</script>
123.cs
namespace stevenator.components
{
using System;
using System.IO;
using System.Web;
using System.Drawing;
using System.Drawing.Imaging;
/// <summary>
/// Summary description for HTTPImage.
/// </summary> public class HTTPImage
{
public HTTPImage()
{
//
// TODO: Add Constructor Logic here
//
} public void outputImageViaHTTP(string absolutePath, HttpResponse Response)
{
FileStream oFileStream;
long lFileSize = 0;
oFileStream = new FileStream(absolutePath, FileMode.Open);
lFileSize = oFileStream.Length; byte[] bBuffer = new byte[(int)lFileSize];
oFileStream.Read(bBuffer, 0, (int)lFileSize);
oFileStream.Close();
Response.ClearContent();
Response.ContentType = "image/gif";
Response.BinaryWrite(bBuffer);
oFileStream.Close();
Response.End();
} public void outputImageViaHTTP(string virtualPath, HttpResponse Response, HttpServerUtility Server) {
string path;
path = Server.MapPath(virtualPath);
outputImageViaHTTP(path, Response);
}}}
<%@ Page Language="c#" ContentType="image/gif" Codebehind="14.aspx.cs" AutoEventWireup="false" %>
<%@ Import Namespace="stevenator.components" %>
<%@ OutputCache Duration="100" VaryByParam="none" %>
<script language="c#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
HTTPImage myHTTPImage = new HTTPImage();
myHTTPImage.outputImageViaHTTP("/010.gif", this.Response, this.Server);
}
</script>
123.cs
namespace stevenator.components
{
using System;
using System.IO;
using System.Web;
using System.Drawing;
using System.Drawing.Imaging;
/// <summary>
/// Summary description for HTTPImage.
/// </summary> public class HTTPImage
{
public HTTPImage()
{
//
// TODO: Add Constructor Logic here
//
} public void outputImageViaHTTP(string absolutePath, HttpResponse Response)
{
FileStream oFileStream;
long lFileSize = 0;
oFileStream = new FileStream(absolutePath, FileMode.Open);
lFileSize = oFileStream.Length; byte[] bBuffer = new byte[(int)lFileSize];
oFileStream.Read(bBuffer, 0, (int)lFileSize);
oFileStream.Close();
Response.ClearContent();
Response.ContentType = "image/gif";
Response.BinaryWrite(bBuffer);
oFileStream.Close();
Response.End();
} public void outputImageViaHTTP(string virtualPath, HttpResponse Response, HttpServerUtility Server) {
string path;
path = Server.MapPath(virtualPath);
outputImageViaHTTP(path, Response);
}}}
<%@ Import Namespace="System.IO" %>
<script language="c#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
FileStream oFileStream;
long lFileSize = 0;
oFileStream = new FileStream(Server.MapPath("/010.gif"), FileMode.Open);
lFileSize = oFileStream.Length;byte[] bBuffer = new byte[(int)lFileSize];
oFileStream.Read(bBuffer, 0, (int)lFileSize);
oFileStream.Close();
Response.ClearContent();
Response.ContentType = "image/gif";
Response.BinaryWrite(bBuffer);
oFileStream.Close();
Response.End();
}
</script>