假如需要返回结果数据如下图所示,如何通过HttpWebRequest请求url路径获得呢
本实例中演示如何通过Newtonsoft.Json实现结果数据的反序列化
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.IO;
using System.Xml.Linq;
using System.Web.Script.Serialization;
using Newtonsoft.Json;
namespace WebApplication8
{
public class ServiceManager
{
public static T GetStr<T>(string url)
{
string SerAadd = url;
XDocument doc;
HttpWebRequest request = WebRequest.Create(SerAadd) as HttpWebRequest;
try
{
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)