On every page on my site i plan on having a username/password textbox and a submit button.
Once the user has logged in im hiding these controls and replacing them with a logout button. Im doing all this with the .visible method.
This works to a point but lets say ive browsed the website and ive decided to login after the third page. If i press the back button i have to refresh the page before the controls become invisible.
Is there a way of making the page not cache certain user controls ? Could i give them their new invisible status with viewstate or postback maybe?
So far ive only found Response.CacheControl = "no-cache"
The only drawback ive noticed is if you go back a few pages sometimes the button events no longer work. As such I have no idea why maybe because the events are no longer cached?
EDIT: Like the dumb person i am I forgot i had <%@ OutputCache Duration="1" %> at the top of my user control... so sometimes the user control would load fine... but since the page took longer than 1 second to load sometimes it just wouldn't appear at all lol!
Im currently working on a portal so I need to always have the current login state displayed because you can login on any page.
Another great thing to check out is smart navigation.
Try inserting it into your page directive:
<%@ Page Language="VB" SmartNavigation = "true"%>
From the documentation:
"Smart navigation is an ASP.NET feature that is supported in Internet Explorer 5.5 and later browsers. It allows a page to be refreshed while maintaining scroll position and element focus between navigations, causing only a single page to be stored in the browser's history, and without the common flicker associated with refreshing a Web page. Smart navigation is best used with ASP.NET pages that require frequent postbacks but with visual content that does not change dramatically on return. Consider this carefully when deciding whether to set this attribute to true."
This seems like a cool feature shame its only for IE
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.