C#后台一般处理程序
public void ProcessRequest(HttpContext context)
{
//context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
context.Response.ContentType = "Multipart/form-data";
string strUserID = context.Request["UserID"];
string strUserName = context.Request["UserName"];
int count = context. Request.Files.Count;
int l = context. Request.Files["theImage" ].ContentLength;
byte[] buffer = new byte[l];
Stream s = context. Request.Files["theImage" ].InputStream;
System.Drawing.Bitmap image = new System.Drawing.Bitmap(s);
//-----------------------------------------------------------------------
Graphics g = Graphics.FromImage(image);
Font f = new Font("宋体", 15); //字体,大小
Brush b = new SolidBrush(Color.Red); //字体颜色
g.DrawString(strUserName, f, b, 35, 35); //开始画,及位置
g.Dispose();
//-----------------------------------------------------------------------
string imgname = Guid.NewGuid().ToString("N") + ".jpg";
string path = "../Images/" + DateTime.Now.ToString("yyyyMMdd") + "/";
if (!Directory.Exists(HttpContext.Current.Server.MapPath(path)))
{
System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath(path));
}
image.Save(HttpContext.Current.Server.MapPath(path + "/" + imgname));
}