一般处理程序乱码解决方法

<%@ WebHandler Language="C#" Class="AttendanceHandHandler" %>

using System;
using System.Web;
using System.Data;
using MyJobSky.MIS.BLL.Attendance;
public class AttendanceHandHandler : IHttpHandler
{

public void ProcessRequest(HttpContext context)
{


context.Response.ContentType = "text/plain";
string sRes = "";
try
{
string mobile = context.Request["mobile"].ToString();//saveID前台的id数组

if (dt.Rows.Count > 0) { sRes = mobile; } else { sRes = ""; }
}
catch (Exception ex)
{
MyJobSky.Common.LogManger.Error(ex.ToString());
}
System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();//转码防止乱码

context.Response.Write(jss.Serialize(sRes));
context.Response.End();
}

public bool IsReusable
{
get
{
return false;
}
}

}

posted @ 2016-10-11 11:43  fightingyy  阅读(992)  评论(0编辑  收藏  举报