Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > page outputcache.... varyByCustom = "Browser"

Thread Tools

page outputcache.... varyByCustom = "Browser"

Posts: n/a
I had .....
<%@ OutputCache Duration="5000" Location="Server" VaryByParam="none" %>

Then I added "browser"
<%@ OutputCache Duration="5000" Location="Server" VaryByParam="none"
VaryByCustom="browser" %>

After I added browser... it stopped caching pages....
is there an explanation or... did I observe the problem wrong?

Hosting company probbably have many more on the same machine.. is there a
chance that cacching will not work, if there are memory constraints.


Reply With Quote
Steven Cheng[MSFT]
Posts: n/a
Hello Nalaka,

As for the OutputCache of ASP.NET page, when you specify the
"VaryByCustom=browser", that means the page's output content will be cached
based on the client-side web request's browser header information(this is
usually stored in useragent http header).

And for your scenario, if you have the following cache setting in page:

<%@ OutputCache Location="server" Duration="300" VaryByParam="none"
VaryByCustom="browser" %>

the page will be cached according to the two flag:

** duration="300"

** VaryByCustom="browser"

So when you use IE to visit the page(no local or remote machine), the
output result will be cached and only after 300 seconds will the cache be
invalid. And if you use another browser(e.g firefox) to visit the page,
the server-side will generate another cache versino of this page, and all
seqential requests from other machine using firefox(same version) will will
get the same cached output (until it expires after 300 seconds).

I've tested this through the following test page:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="OutputCachePage.aspx.cs" Inherits="Cache_OutputCachePage"
<%@ OutputCache Location="server" Duration="300" VaryByParam="none"
VaryByCustom="browser" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="" >
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">


=========code behind=========
public partial class Cache_OutputCachePage : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
Response.Write("<br/>Datetime: " + DateTime.UtcNow.ToString());


As for the "it stopped caching pages", what's the detailed behavior? Do you
mean no matter you use different browser not not, it will always output new
updated content each time you send reqeust to the page(refresh the browser)?

Please feel free to let me know if you have anything unclear.


Steven Cheng

Microsoft MSDN Online Support Lead


Get notification to my posts through email? Please refer to

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at


This posting is provided "AS IS" with no warranties, and confers no rights.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to put page specific script in a page that inherits from a master page? Eric ASP .Net 0 04-24-2006 11:54 PM
Page not found error when navigating from the child page back to the parent page Samy Java 0 02-04-2006 01:29 AM
Page load of the parent page called twice when a modal dialog is opened from a button click of the user control on the parent page Samy ASP .Net 2 08-15-2005 03:30 PM
RE: Web page is not available - "The Web page you requested is not available offline. To view this page, click Connect" =?Utf-8?B?VHJldm9yIEJlbmVkaWN0IFI=?= ASP .Net 0 06-07-2004 07:11 AM
Re: Web page is not available - "The Web page you requested is not available offline. To view this page, click Connect" Natty Gur ASP .Net 0 06-06-2004 05:46 AM