Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.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# 为什么可以';t我将对象传递到在Webservice中创建的会话中_C#_Asp.net_Web Services - Fatal编程技术网

C# 为什么可以';t我将对象传递到在Webservice中创建的会话中

C# 为什么可以';t我将对象传递到在Webservice中创建的会话中,c#,asp.net,web-services,C#,Asp.net,Web Services,为什么我不能将我的对象传递到在Webservice中创建的会话中 [WebMethod] public void UpdatedData(string CountryName, string CountryCode, string City, string RegionCode, string RegionName) { Chat ch = new Chat(); ch.CountryName = Coun

为什么我不能将我的对象传递到在Webservice中创建的会话中

[WebMethod]
public void UpdatedData(string CountryName, string CountryCode,
                        string City, string RegionCode, string RegionName) 
{            
    Chat ch = new Chat();
    ch.CountryName = CountryName;
    ch.CountryCode = CountryCode;
    ch.City = City;
    ch.RegionCode = RegionCode;
    ch.RegionName = RegionName;
    Session["Chat"] = ch;  //object Refrence not set to instance of an object
}

请在上述方法上方添加以下代码:

[System.Web.Services.WebMethod(EnableSession=true)]

请在上述方法上方添加以下代码:

[System.Web.Services.WebMethod(EnableSession=true)]

谢谢,但现在我无法在我的应用程序中使用此会话任何帮助为什么请解释您的问题我不是虚拟配置文件n我也很喜欢您的评论@mahu您能告诉我如何使用此会话,因为当我使用它时它将为空吗?谢谢,但现在我无法在我的应用程序中使用此会话任何帮助为什么请解释您的问题我不是虚拟的profile n我也很喜欢你的评论@mahu你能告诉我如何使用这个会话吗?当我使用它时,它将为空。现在我如何在我的网页上使用这个会话?每次提交空。现在我如何在我的网页上使用这个会话?每次提交空