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

<%@ 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;
}
}

}

原文地址:https://www.cnblogs.com/momjs/p/5948675.html