Search code examples
c#asp.netreflectioniis-7reflectionpermission

HttpRuntime CacheInternal NULL reference exception while reading user sessions (Reflection)


After some updates on our windows servers(2008R2 ,2012) Asp.net application throwing error:

var obj_1 = typeof(HttpRuntime).GetProperty("CacheInternal", BindingFlags.NonPublic | BindingFlags.Static); 

CacheInternal is coming null, dont know why ?

following solution is not working :( Solution

enter image description here


Solution

  • I have find the solution. Now HTTPRuntime class doesnt have CacheInternal Property.So to achive the above task I have created a global list adding sessions in that list in Session_Start and removing the sessions in Sessions_end functions of Global.asax.