Note: i added <remove name="Session" /> row because when i want to run project it didnt work and give a message. (HTTP Error 500.19 - Internal Server Error,
Config Error
Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'Session'
)
than i add EnableSessionState="True" prefix in Default.aspx file
Please also try to implement IReadOnlySessionState or IRequiresSessionState interface for your service, as mentioned in the articles referred in my previous post.
I can read Session["engin"] value Default.aspx.cx file but i can not read Session["engin"] value in web service.
It's really bad design to implement statefull web services. Is there any reason why you don't simply pass Session["engin"] from the web app since you already have it? Why save the same data in two different places?
Member
2 Points
32 Posts
I can not read Session Data from Web Service
Nov 16, 2016 10:44 AM|davilanka|LINK
Hi everybody,
I create web application. Then create wsOTURUM.asmx web service. Then I wrote this code in wsOTURUM.asmx
In the Default.aspx.cs
But always dddd variable is null.
I can read Session["engin"] value Default.aspx.cx file but i can not read Session["engin"] value in web service.
Not: Default.aspx and wsOTURUM.asmx are in the same project.
Star
9052 Points
2255 Posts
Re: I can not read Session Data from Web Service
Nov 16, 2016 11:54 AM|Siva Krishna Macha|LINK
Make sure you have following in web.config file of asmx
Reference: http://stackoverflow.com/a/20919276
Also make sure your web service implements either IReadOnlySessionState or IRequiresSessionState interface.
References:
https://devnet.kentico.com/articles/context-values-in-generic-handlers-(-ashx)-and-web-services-webmethods-(-asmx)
http://stackoverflow.com/a/12936466
http://www.hanselman.com/blog/GettingSessionStateInHttpHandlersASHXFiles.aspx
Thanks & Regards,
Siva
Member
2 Points
32 Posts
Re: I can not read Session Data from Web Service
Nov 16, 2016 01:29 PM|davilanka|LINK
Thanks Siva Krishna Macha,
Unforcunately it still not work.
I added your code in web.config
Note: i added <remove name="Session" /> row because when i want to run project it didnt work and give a message. (HTTP Error 500.19 - Internal Server Error,
)
than i add EnableSessionState="True" prefix in Default.aspx file
But it didn't work.
Star
9052 Points
2255 Posts
Re: I can not read Session Data from Web Service
Nov 17, 2016 10:40 AM|Siva Krishna Macha|LINK
Please also try to implement IReadOnlySessionState or IRequiresSessionState interface for your service, as mentioned in the articles referred in my previous post.
Thanks & Regards,
Siva
All-Star
52971 Points
23571 Posts
Re: I can not read Session Data from Web Service
Nov 17, 2016 12:39 PM|mgebhard|LINK
It's really bad design to implement statefull web services. Is there any reason why you don't simply pass Session["engin"] from the web app since you already have it? Why save the same data in two different places?