add new imageHandler.aspx
using System.IO;
protected void Page_Load(object sender, EventArgs e)
{
string fileName = Request.QueryString["src"];
long fileSize = 0;
if (string.IsNullOrEmpty(fileName))
{
fileName = "empty.gif";
}
fileName = Server.MapPath("..\\images\\" + fileName);
FileStream fileStream = default(FileStream);
fileStream = new FileStream(fileName, FileMode.Open);
fileSize = fileStream.Length;
byte[] Buffer = new byte[Convert.ToInt32(fileSize) + 1];
fileStream.Read(Buffer, 0, Convert.ToInt32(fileSize));
fileStream.Close();
Response.BinaryWrite(Buffer);
}
add new default.aspx
<img src="imageHandler.aspx?src=1.jpg" />
using System.IO;
protected void Page_Load(object sender, EventArgs e)
{
string fileName = Request.QueryString["src"];
long fileSize = 0;
if (string.IsNullOrEmpty(fileName))
{
fileName = "empty.gif";
}
fileName = Server.MapPath("..\\images\\" + fileName);
FileStream fileStream = default(FileStream);
fileStream = new FileStream(fileName, FileMode.Open);
fileSize = fileStream.Length;
byte[] Buffer = new byte[Convert.ToInt32(fileSize) + 1];
fileStream.Read(Buffer, 0, Convert.ToInt32(fileSize));
fileStream.Close();
Response.BinaryWrite(Buffer);
}
add new default.aspx
<img src="imageHandler.aspx?src=1.jpg" />
No comments:
Post a Comment