ASP. NET WebService return JSON data garbled resolution method

Source: Internet
Author: User

[WebMethod]Public voidQueryrisknotice (stringPhone) {Try{vardata = _risknoticedal.queryrisknotice (phone);varList = fromDainchData. AsEnumerable ()Select New{//Notification numberNumber = da. field<string> ("T_number"),//Note DateDate = da. field<string> ("T_date"),//Notification Master deliveryZs = da. field<string> ("T_zs"),//Notification of power outage equipment and durationTdsb_gq = da. field<string> ("T_tdsb_gq"),//Notification run risk analysisYxfxfx = da. field<string> ("T_yxfxfx"),//Notification of risk pre-control measuresFxykcs = da. field<string> ("T_FXYKCS"),//Notification order Status: 0: Unpublished 1: Published 2: Audited 3: Issued 4: confirmed 5: FiledZT = da. field<int> ("ZT"),//Notification Send dateSend_dt = da. field<DateTime?> ("T_send_dt"),//Invoice Creation dateCreatedt = da. field<DateTime?> ("T_createdt"),//Notification person namename = da. field<string> ("T_name"),//Notice person Type: 1: Approver 2: Issuer 3: Department of Transportation 4: Marketing Department 5: Quality Department 6: CustomerType = da. field<int> ("T_type"),//Notification form signature Status 0: unsigned, 1: SignedRyzt = da. field<int> ("Ryzt"),//Notification picture pathimg = da. field<string> ("T_img"),//Notification form Signature DateSignerdt = da. field<DateTime?> ("T_signerdt")                       }; _hashtable["Issuccess"] =true; _hashtable["MSG"] ="Get Success"; _hashtable["Data"] = list. ToList (); //Solve garbled code: Context.Response.ContentType = "Text/plain;charset=utf-8";Context.Response.Write (_JSS.    Serialize (_hashtable)); }Catch(Exceptione) {Log.debug ("Method Name: Queryrisknotice, Error reason:"+ e.message); _hashtable["Issuccess"] =false; _hashtable["MSG"] ="Get Failed"; _hashtable["Data"] =NULL;varJSON = _JSS.        Serialize (_hashtable);    Context.Response.Write (JSON); }}

ASP. NET WebService return JSON data garbled resolution method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.