Disabling Cache

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
1/8/2007 2:24:53 PM
Gravatar
Total Posts 80

Disabling Cache

Mojo allows the browser to cache pages. This is bad when a user is viewing a sensitive page protected by roles because when the user logs out the sensitive page is still viewable by hitting the "Back" button.

I am able to disable the browser cache by placing the following in the Default.aspx page load:

            Response.Cache.SetExpires(new DateTime(1995, 5, 6, 12, 0, 0, DateTimeKind.Utc));
            Response.Cache.SetNoStore();
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
            Response.Cache.AppendCacheExtension("post-check=0,pre-check=0");

This seems to work well in Firefox and IE. However, this only applies to certain pages that are tied to the Default.aspx in some way that I do not understand. The /Secure/UserProfile.aspx page, for example, is still cached with the above code.

Any thoughts on how to disable cache for the entire MojoPortal?

Regards,
Jesse
1/9/2007 4:04:55 AM
Gravatar
Total Posts 18439

Re: Disabling Cache

I think you have a good point. In my opinion to do this correctly we need a page setting so we can specify on a page by page basis whether to allow browser caching. In many cases for performance we do want to allow it but I agree from a security point of view we need a mechanism to disallow it on some pages.

The relationship with Default.aspx is that Default.aspx handles all requests for virtual pages in the content system but there are some physical pages like Secure/UserProfile.aspx as well as edit pages like BlogEdit.aspx etc that acutally exist on disk. Every page listed in the menu is a virtual page and really the request is like Default.aspx?pageid=somepageid but we use url re-writing to make friendly urls like home.aspx so you don't see the pageid in the url but it really is there. So we need a page setting for these virtual pages and we can disable cache for other physical pages on a case by case basis, definitely for userprofile.aspx and other secure pages.

I will look into implementing this.

Thanks,

Joe
1/9/2007 8:31:07 AM
Gravatar
Total Posts 18439

Re: Disabling Cache

I've implemented a new setting in PageSettings for AllowBrowserCache, it defaults to true but can be set to false for any page in the content system. I have also disabled browser caching on a number of physical pages where I think it should be disabled.

These changes are available now in svn branches/2.x

I plan to make a new release this weekend, if you have any chance to test the svn version and provide feedback between now and then it would be much appreciated.

Thanks,

Joe
1/9/2007 12:41:02 PM
Gravatar
Total Posts 80

Re: Disabling Cache

Awesome!

I merged with the latest SVN and the caching works exactly as requested. I like your robust solution of allowing individual pages to customize caching even though we will have caching disabled by default for every page (perhaps a site setting option to disable caching by default and have the page setting override?). Thanks for the fast responses and agile turnaround.

-Jesse
You must sign in to post in the forums. This thread is closed to new posts.