0

I am using a web service in ASP.NET page, but I am unable to create cookie in web service. After creating a cookie I want to retrieve its value in my on JavaScript function.

Example:

HttpCookie cookie = new HttpCookie("doc1count");
cookie.Value = "my values nitesh";
HttpContext.Response.Cookies.Add(Cookie); 

But this code is not working in asmx web service

Also I want to retrieve its value on my ASP.NET page in JavaScript, if this task is not possible using cookies, then how do I do that with session?

mason
  • 31,774
  • 10
  • 77
  • 121
Mango People
  • 31
  • 1
  • 1
  • 7
  • Look this: [http://stackoverflow.com/questions/15519454/how-can-i-access-session-variables-and-set-them-in-javascript](http://stackoverflow.com/questions/15519454/how-can-i-access-session-variables-and-set-them-in-javascript) [http://stackoverflow.com/questions/3297637/getting-session-in-net-asmx-web-service](http://stackoverflow.com/questions/3297637/getting-session-in-net-asmx-web-service) – JACA_001 Oct 18 '15 at 17:51
  • but i am unable to create session in asmx web service, shows me the error the the name 'Session' does not exists in the current context, i have also tried [WebMethod(EnableSession = true)] but its not working – Mango People Oct 18 '15 at 18:03
  • [http://stackoverflow.com/questions/6969563/session-does-not-exist-in-the-current-context](http://stackoverflow.com/questions/6969563/session-does-not-exist-in-the-current-context) – JACA_001 Oct 18 '15 at 18:20

0 Answers0