<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="上传" /><br />
<asp:Image ID="Image1" runat="server" />
后台
Button1.Click += Button1_Click;
void Button1_Click(object sender, EventArgs e)
{
//获得要上传的图片
System.Drawing.Image img = System.Drawing.Image.FromStream(FileUpload1.FileContent);
//加上水印
Graphics g = Graphics.FromImage(img);
string s = "WWW.ITNBA.COM";
Font f = new Font("微软雅黑", 30);
Brush b = new SolidBrush(Color.Red);
PointF pf = new PointF(50, 50);
g.DrawString(s, f, b, pf);
//保存下来
string path = "Uploads/" + DateTime.Now.ToString("yyyyMMddhhmmssms") + FileUpload1.FileName;
img.Save(Server.MapPath(path));
Image1.ImageUrl = path;
}