How to clear browser cache when user log off in asp.net using c#? -
as new in asp.net. in asp.net application in membership in log off
on click event
using function clearsession()
, problem arises after log off if click button on browser forwarding cached page. how clear cache in browser user not view profile if not login
protected void clearsession() { formsauthentication.signout(); session.clear(); response.cache.setcacheability(httpcacheability.nocache); response.expiresabsolute = datetime.utcnow.adddays(-1d); response.expires = -1500; response.cachecontrol = "no-cache"; }
i think there. need more html headers support browsers. according this article on so these ones work on browsers:
cache-control: no-cache, no-store, must-revalidate pragma: no-cache expires: 0
the full code is:
httpcontext.current.response.addheader("cache-control", "no-cache, no-store, must-revalidate"); httpcontext.current.response.addheader("pragma", "no-cache"); httpcontext.current.response.addheader("expires", "0");
Comments
Post a Comment