0

I check session in a class. but Session property is null I mean not the variable session property.

normally we can check like this. session it's null or not

if(HttpContext.Current.Session["member_login"] !=null)

but **HttpContext.Current.Session** This part of code line is null without string variable. Whats the problem I've searched stack overflow but I can't find like this problem

Webservices causes this problem but When we add this property over the webmethod we can solve it

[WebMethod (EnableSession = true)]

is this problem something like that?

enter image description here

enter image description here

check second image session property is null

PsyGnosis
  • 1,489
  • 6
  • 21
  • 28

1 Answers1

0

Please check below link

How to access session variables from any class in ASP.NET?

Community
  • 1
  • 1
Ratheesh
  • 549
  • 4
  • 15
  • I know that. I said it on my first post. is this something like that? and HttpContext.Current.Session this is giving me null so I cannot check HttpContext.Current.Session["member_login"] it's like webservice calling but it's a random class – PsyGnosis Mar 12 '17 at 13:44
  • Can you please add this runAllManagedModulesForAllRequests="true" on your web.config under system.webServer>modules and try – Ratheesh Mar 12 '17 at 13:50
  • it's not working can u check my first post I've edited. Check second picture. – PsyGnosis Mar 12 '17 at 14:00
  • Are u checking session in a class[Auth] library? – Ratheesh Mar 12 '17 at 14:05
  • it's not a class library. it is a simple class – PsyGnosis Mar 12 '17 at 14:08
  • have you fixed this issue? If not, please paste entire code of that class after hiding sensitive info – Ratheesh Mar 13 '17 at 04:44