I want to know if sessions are maintained through ajax calls. I have a Sencha(JS) client which makes ajax GET calls to the server.Server side is implemented using WCF C# .Now when I make the first call the session should start and it seems it is starting. but when the application is making the next call which needs the server to retrieve some value from session which it saved in the first call i am getting an error.As the first call where the session is getting set is nt throwing error so I believe session is getting started. But in the 2nd call it is throwing error.
我想知道是否通过ajax调用维护会话。我有一个Sencha(JS)客户端,它对服务器进行ajax GET调用。服务器端使用WCF C#实现。现在,当我进行第一次调用时,会话应该启动,它似乎正在启动。但是当应用程序正在进行下一次调用时,需要服务器从第一次调用中保存的会话中检索某些值我得到一个错误。作为会话设置的第一个调用是nt抛出错误所以我相信会话正在开始。但是在第二次调用中它会抛出错误。
POINT TO BE NOTED : This is only happening when calling through application. If I am calling simply hitting the GET url in browser everything working perfectly.
需要注意的地方:这只是在通过应用程序调用时才会发生。如果我打电话只是在浏览器中点击GET url一切正常。
Please help what could be the reason. I am at a loss.
请帮助可能是什么原因。我很茫然。
1 个解决方案
#1
1
Sessions are mapped using a session cookie.
会话使用会话cookie进行映射。
You should verify that your application is actually forwarding the session cookie in the call that fails. Enumerate all cookies in the call that works and the call that fails and compare.
您应该验证您的应用程序是否实际转发了失败的调用中的会话cookie。枚举有效的呼叫中的所有cookie以及失败和比较的呼叫。
Continued:
继续:
I usually do ajax via a generic handler (.ashx) I use as a facade that in turn calls any sub systems. In this handler I do parameter conversion and json (de)serialization. Maybe you should go for such an approach and not expose your WCF layer?
我通常通过通用处理程序(.ashx)来执行ajax。我使用它作为外观,然后调用任何子系统。在这个处理程序中,我做参数转换和json(de)序列化。也许你应该采用这种方法而不是暴露你的WCF层?
#1
1
Sessions are mapped using a session cookie.
会话使用会话cookie进行映射。
You should verify that your application is actually forwarding the session cookie in the call that fails. Enumerate all cookies in the call that works and the call that fails and compare.
您应该验证您的应用程序是否实际转发了失败的调用中的会话cookie。枚举有效的呼叫中的所有cookie以及失败和比较的呼叫。
Continued:
继续:
I usually do ajax via a generic handler (.ashx) I use as a facade that in turn calls any sub systems. In this handler I do parameter conversion and json (de)serialization. Maybe you should go for such an approach and not expose your WCF layer?
我通常通过通用处理程序(.ashx)来执行ajax。我使用它作为外观,然后调用任何子系统。在这个处理程序中,我做参数转换和json(de)序列化。也许你应该采用这种方法而不是暴露你的WCF层?