Problem with cache asp.net
VS2005, ASP.NET, C#, IIS6
Hello friends, I have a master page divided into three sections i.e. header, details, footer.
The header section contains web user control having AJAX tab container. We are showing or hiding tabs according to user previleges. Initially only one ta开发者_开发问答b is active showing user to log in. When the user logs in other tabs are activated.
I have used <%@ OutputCache Duration="120" VaryByParam="none" %> within my user control. When the user logs in NullReferenceException is generated on one of the method within that control.
When I remove the OutputCache, everything works fine.
Could someone guide me what should i do?
Thanks in advance
The "easy" way to fix this is to check if the value is null, if it is null create it.
A better way would be to find out why it is null.
One possibility is that the first time that page is called there is a parameter that determines that one of the controlls should not be created. The second time it is called it is called with a parameter that say that the controll is required, but it is using a cached version of the page that does not have that controll.
精彩评论