Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / October 2005

Tip: Looking for answers? Try searching our database.

parameterized URLs necessary for output caching ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John A Grandy - 29 Sep 2005 22:53 GMT
For a highly scalable app, to properly implement output-caching of pages
(page-fragments, user-controls, etc.) is it necessary to utilize
parameterized URLs ?

Is there an alternate method to implement output-caching ?

The reason I ask is that I don't like parameterized URLs.  Reason being that
it is a
complex and time-consuming process to threat model and write code to protect
against query string hacks.

I'd like to ask this question for ASP.NET 1.1 and ASP.NET 2.0.

My app uses ASP.NET Web Controls for all user-entries.

Thanks.
Venkat_KL - 07 Oct 2005 06:22 GMT
Dear John A Grandy,

Your Question:
For a highly scalable app, to properly implement output-caching of pages
(page-fragments, user-controls, etc.) is it necessary to utilize
parameterized URLs ?

Ans. No, It is not necessary to urilize  parameterized URLs. You can use @
OutputCache Directive either in the page or control

First of all what do you mean by  parameterized URLs ?, Is it Query String
that you are talking?

Ok, If you want to use @ OutputCache Directive

@OutputCache  Declaratively controls the output caching policies of an
ASP.NET page or a user control contained in a page

<%@ OutputCache
Duration="#ofseconds"
Location="Any | Client | Downstream | Server | None"
Shared="True | False"
VaryByControl="controlname"
VaryByCustom="browser | customstring"
VaryByHeader="headers"
VaryByParam="parametername" %>

The Detail Description of Attributes
*************************
Duration
=====
The time, in seconds, that the page or user control is cached. Setting this
attribute on a page or user control establishes an expiration policy for HTTP
responses from the object and will automatically cache the page or user
control output.
Note   This attribute is required. If you do not include it, a parser error
occurs.

Location
=====
One of the OutputCacheLocation enumeration values. The default is Any.
CAUTION   This attribute is not supported for @ OutputCache directives
included in user controls (.ascx files).

Shared
=====
A Boolean value that determines whether user control output can be shared
with multiple pages. The default is false. For more information, see the
Remarks section.
Note   This attribute is not supported for @ OutputCache directives included
in ASP.NET pages (.aspx files).

VaryByCustom
=========
Any text that represents custom output caching requirements. If this
attribute is given a value of browser, the cache is varied by browser name
and major version information. If a custom string is entered, you must
override the HttpApplication.GetVaryByCustomString method in your
application's Global.asax file.

VaryByHeader
=========
A semicolon-separated list of HTTP headers used to vary the output cache.
When this attribute is set to multiple headers, the output cache contains a
different version of the requested document for each specified header.

Note :  Setting the VaryByHeader attribute enables caching items in all HTTP
1.1 caches, not just the ASP.NET cache. This attribute is not supported for @
OutputCache directives in user controls.

VaryByParam
=========
A semicolon-separated list of strings used to vary the output cache. By
default, these strings correspond to a query string value sent with GET
method attributes, or a parameter sent using the POST method. When this
attribute is set to multiple parameters, the output cache contains a
different version of the requested document for each specified parameter.
Possible values include none, *, and any valid query string or POST parameter
name.

CAUTION  : This attribute is required when you output cache ASP.NET pages.
It is required for user controls as well unless you have included a
VaryByControl attribute in the control's @ OutputCache directive. A parser
error occurs if you fail to include it. If you do not want to specify a
parameter to vary cached content, set the value to none. If you want to vary
the output cache by all parameter values, set the attribute to *.

VaryByControl
=========
A semicolon-separated list of strings used to vary a user control's output
cache. These strings represent the ID property values of ASP.NET server
controls declared in the user control. For more information, see Caching
Portions of an ASP.NET Page.

Note :  This attribute is required in a user control @ OutputCache directive
unless you have included a VaryByParam attribute. This attribute is not
supported for @ OutputCache directives in ASP.NET pages

Example:

<%@ OutputCache Duration="100" VaryByParam="none" %>

************************************************************
Fragment Caching
============
Fragment caching is useful when you need to cache only a subset of a page.
This is accomplished by caching the outputs of a user control. Navigation
bars, headers, and footers are good candidates for fragment caching.

Sometimes it is impractical to cache an entire page; portions of the page
may need to be dynamically created for each request. In these cases, it can
be worthwhile for you to identify the objects or data associated with the
page request that require significant server resources to construct. Once you
identify these items, you can isolate them from the rest of the page by
creating them in Web Forms user controls, and cache them for a period of time
that you specify in order to save server resources. This is known as fragment
caching.

bye
venkat_kl

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.