471,082 Members | 881 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,082 software developers and data experts.

page outputcache.... varyByCustom = "Browser"

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.

Oct 13 '06 #1
1 4711
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="http://www.w3.org/1999/xhtml" >
<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.

Oct 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Simon Wigzell | last post: by
3 posts views Thread by Jukka K. Korpela | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.