Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 基于querystring从页面url获取json数据_C#_Asp.net_Json - Fatal编程技术网

C# 基于querystring从页面url获取json数据

C# 基于querystring从页面url获取json数据,c#,asp.net,json,C#,Asp.net,Json,我正在使用一个asp.net应用程序,其中一页数据必须转换为json格式。为此,我在页面加载事件中使用了这段代码 if(Request.QueryString[“AppMode”!=null) { 使用(WebClient wc=new WebClient()) { var json=wc.DownloadString(“http://localhost:1469/WorldVentures/success-故事); } }添加此代码 protected void Page_Load(obj

我正在使用一个asp.net应用程序,其中一页数据必须转换为json格式。为此,我在页面加载事件中使用了这段代码


if(Request.QueryString[“AppMode”!=null)
{
使用(WebClient wc=new WebClient())
{
var json=wc.DownloadString(“http://localhost:1469/WorldVentures/success-故事);
}
}
添加此代码

protected void Page_Load(object sender, EventArgs e)
{
    //run when first time page load
    if (Page.IsPostBack)
    {
       //your code
    }
}

如果(!IsPostback),是否尝试将此条件放入
中?