Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Unclear how to control OutputCache on plain Razor pages #1

Closed
dgfitch opened this issue Oct 2, 2013 · 2 comments
Closed

Unclear how to control OutputCache on plain Razor pages #1

dgfitch opened this issue Oct 2, 2013 · 2 comments
Labels

Comments

@dgfitch
Copy link

dgfitch commented Oct 2, 2013

This is more of a stupid question than an issue, but I'm not sure how to define the OutputCache either at a default level or for individual .cshtml pages.

Putting OutputCache attributes on controllers works as expected, I'm just not sure how it would work to insert as a directive in a .cshtml page.

@maxtoroq
Copy link
Owner

maxtoroq commented Oct 3, 2013

There's no such directive in razor, unlike aspx. Use Response.Cache directly, e.g.

Response.Cache.SetCacheability(HttpCacheability.NoCache);

@maxtoroq maxtoroq closed this as completed Oct 6, 2013
@dgfitch
Copy link
Author

dgfitch commented Oct 9, 2013

Awesome, works great when set in layout as the default. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants