Default.aspx.cs kodu:
using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string ImageFile = Server.MapPath("resim.jpg");
System.Drawing.Image objImage = System.Drawing.Bitmap.FromFile(ImageFile);
Response.Clear();
Response.ClearContent();
Response.ContentType = "images/jpeg";
Response.AddHeader("Content-Disposition", "attachment; filename=Image.jpg;");
System.IO.MemoryStream objMem = new System.IO.MemoryStream();
objImage.Save(objMem, System.Drawing.Imaging.ImageFormat.Jpeg);
objMem.WriteTo(Response.OutputStream);
//objImage.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.End();
}
}
//Bir sonraki makalede buluşmak üzere. Bahadır ŞAHİN
0 comments:
Yorum Gönder