首页 > 代码库 > 获取Json数据

获取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 jsonDatahttp://www.mamicode.com/= "";
    string sendWayId = Request.QueryString["sendWayId"];
    if (!string.IsNullOrEmpty(sendWayId))
    {
      SendWay sendWay = OrderInfoManager.GetSendWayById(Int32.Parse(sendWayId));
      if (sendWay != null)
      {
        jsonData = http://www.mamicode.com/JsonConvert.SerializeObject(sendWay);
      }
    }
    return jsonData;
  }
}