kathir velu

kathir velu

  • NA
  • 74
  • 960

HttpRuntime Cache value automatically cleares in idle state

May 2 2014 7:10 AM

Hi, 

we are developing an mobile application and we have used WCF service to fetch SQL Server data through online.

We are trying to authenticate each WCF Service call(server) by passing headers from client (mobile application). For this we have generated a token and passed the same in headers of each client call.

We have stored the tokens in HttpRuntime.Cache. But after few minutes [in idle mode] the cache entry is cleared.

Note: If continuously server and client communicates, it works perfectly.

Below is our WCF service Cache code:

HttpRuntime.Cache.Insert(key, Token, null, DateTime.Now.AddHours(1),Cache.NoSlidingExpiration);

if some other better solution available, kindly suggest how we can save the tokens alone in server and authenticate the same from client for each service call.