asp.Netwebserviceはjsonデータの乱符号化の解決方法を返します

5282 ワード

[WebMethod]
public void QueryRiskNotice(string phone)
{
    try
    {
        var data = _riskNoticeDal.QueryRiskNotice(phone);
        var list = from da in data.AsEnumerable()
                   select new
                       {
                           //      
                           number = da.Field<string>("t_number"),
                           //      
                           date = da.Field<string>("t_date"),
                           //      
                           zs = da.Field<string>("t_zs"),
                           //           
                           tdsb_gq = da.Field<string>("t_tdsb_gq"),
                           //          
                           yxfxfx = da.Field<string>("t_yxfxfx"),
                           //          
                           fxykcs = da.Field<string>("t_fxykcs"),
                           //         :0:    1:    2:    3:    4:    5:   
                           zt = da.Field<int>("zt"),
                           //        
                           send_dt = da.Field<DateTime?>("t_send_dt"),
                           //        
                           createdt = da.Field<DateTime?>("t_createdt"),
                           //        
                           name = da.Field<string>("t_name"),
                           //        :1:    2:    3:    4:    5:    6:  
                           type = da.Field<int>("t_type"),
                           //        0:   ,1:   
                           ryzt = da.Field<int>("ryzt"),
                           //        
                           img = da.Field<string>("t_img"),
                           //        
                           signerdt = da.Field<DateTime?>("t_signerdt")
                       };
        _hashtable["isSuccess"] = true;
        _hashtable["msg"] = "    ";
        _hashtable["data"] = list.ToList();
        //      : Context.Response.ContentType = "text/plain;charset=utf-8";
        Context.Response.Write(_jss.Serialize(_hashtable));
    }
    catch (Exception e)
    {
        Log.Debug("   :QueryRiskNotice,    :" + e.Message);
        _hashtable["isSuccess"] = false;
        _hashtable["msg"] = "    ";
        _hashtable["data"] = null;
        var json = _jss.Serialize(_hashtable);
        Context.Response.Write(json);
    }
}