C# 为什么可以';t我将对象传递到在Webservice中创建的会话中
为什么我不能将我的对象传递到在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
[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你能告诉我如何使用这个会话吗?当我使用它时,它将为空。现在我如何在我的网页上使用这个会话?每次提交空。现在我如何在我的网页上使用这个会话?每次提交空