获取Json数据

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JsonSendWay.aspx.cs" Inherits="JsonSendWay" %>

<% =GetJsonData()%>

//代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json;

public partial class JsonSendWay : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {



  }
  protected string GetJsonData()
  {
    string jsonData = "";
    string sendWayId = Request.QueryString["sendWayId"];
    if (!string.IsNullOrEmpty(sendWayId))
    {
      SendWay sendWay = OrderInfoManager.GetSendWayById(Int32.Parse(sendWayId));
      if (sendWay != null)
      {
        jsonData = JsonConvert.SerializeObject(sendWay);
      }
    }
    return jsonData;
  }
}

  

原文地址:https://www.cnblogs.com/simpleBlue3/p/3889112.html