<%@ WebHandler Language="c#" Class="File_WebHandler" Debug="true" %>
using System;
using System.Web;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Configuration;

public class File_WebHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState  //实现这个接口，意味着要实现该接口的两个方法： ProcessRequest和 IsReusable
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";  //响应数据类型context.Request.Files.Count > 0 && 
        if (context.Request.Files.Count > 0)
        {
            if (!Dcx.Common.VonleHelper.IsLogined())
            {
                context.Response.Write("0");  //返回最后结果
                context.Response.End();
                return;
            }
            string errMsg = "";
            int successCount = 0;
            bool IsOk = Dcx.Common.FileOperate.UpLoadFile(context, false, ref  successCount, ref  errMsg);
            //返回最后结果
            if (IsOk)
                context.Response.Write(successCount.ToString ());
            else
                context.Response.Write(successCount.ToString ()+"||"+errMsg);  //返回最后结果
            context.Response.End();
        }
    }
    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}
