asp.net - Can we store Session state and Cache on Redis Cache in same application? -
i implementing redis cahce in ongoing application in have implemented redis cache session state , sessions storing on redis cache.
web.config settings below,
add name="mysessionstatestore" type="microsoft.web.redis.redissessionstateprovider" port="6280" throwonerror="true" connectionstring="webapplication1.redis.cache.windows.net:6380,password=some password,ssl=true,abortconnect=false" host="webapplication1.redis.cache.windows.net" accesskey="some key" ssl="true"
similarly have move current caching implementation on redis cahce have implemented in below code snippet(in vb.net),
public function getapplicationcachedata() dataset const rawkey string = "akey_" dim dsdata dataset dim connection connectionmultiplexer = connectionmultiplexer.connect("webapplication1.redis.cache.windows.net:6280,password=some password,ssl=true,abortconnect=false") dim redisobj idatabase = connection.getdatabase() dim valueobj redisvalue = redisobj.stringget(rawkey) if not valueobj.hasvalue dsdata = class1.getapplicationcachedata() redisobj.stringset(rawkey,jsonconvert.serializeobject(dsdata), timespan.fromminutes(90)) else dsdata = jsonconvert.deserializeobject(of dataset)(redisobj.stringget(rawkey)) end if return dsdata end function now problem caching implementation working fine if run separately session state when implement session state , caching in redis cache sessions become null , page redirects login page form authentication.
we created 1 test application on azure portal , using same session state , caching storage.
so question is, can use 1 application both implementation or should create application on portal run cache functionality in redis cahce or implementation has inconsistency?
have tried setting "applicationname" parameter on session state configuration?
Comments
Post a Comment