[英]SessionId changes while calling a method from a Webservice
I have two projects. 我有两个项目。 One of them has a WebService(asmx) and the second one uses the WebService as a reference.
其中一个具有WebService(asmx),第二个使用WebService作为参考。
This is the WebMethod: 这是WebMethod:
[WebMethod(EnableSession = true)]
public int GetDocCount(CompressedData data)
{
if (Session[Settings.cStrSessionUserLogin] == null)
{
return 0;
}
string xmlString = EncoderUtil.Decompress(data);
SortFilterSet sfs = (SortFilterSet)XmlUtil.Deserialize(typeof(SortFilterSet), xmlString);
Session[Settings.cStrSessionSortFilterSet] = sfs;
Session[Settings.cStrSessionOrderCodeList] = null;
return Database.GetOrderCount((List<RequestorInfo>)Session[Settings.cStrSessionRequestorList], sfs.FilterSet, sfs.SearchPattern);
}
When i create the client i have one sessionid, but whenever i call the WebMethod i see the SessionId changes inside the WebMethod(i can see that with Debug) 当我创建客户端时,我有一个sessionid,但是每当我调用WebMethod时,我都会在WebMethod中看到SessionId的变化(我可以通过Debug看到它)
MyWebServiceSoapClient client = new MyWebServiceSoapClient();
int countDocs = client.GetDocCount(data);
Why am I seeing a new SessionId in the WebMethod, and how can I avoid this and get the original SessionId? 为什么在WebMethod中看到新的SessionId,如何避免这种情况并获得原始的SessionId?
EDIT : Inside the WebMethod Session.Count is always 0 编辑: WebMethod Session.Count内部始终为0
I deleted the WebService reference and then i inserted the MyWebServiceSoapClient.asmx and MyWebServiceSoapClient.cs in my project. 我删除了WebService参考,然后在项目中插入了MyWebServiceSoapClient.asmx和MyWebServiceSoapClient.cs。 Now i don't get the new SesseionId's anymore.
现在,我不再拥有新的SesseionId。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.