[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

Outputcache at Postback gives incorrect results with VaryByParam

Garfield

2/11/2010 10:25:00 PM

ASP. NET3.5 - C# - IIS 6

Hi,
I am having a weird issue happening with outputcache. I have multiple user
controls on a page, one of which is a login control. The page and the login
control is NOT cached, but other user controls are cached with VaryByParam.
Now all of this works along with caching when I click on to different pages.
But as soon as I login, other user controls on that page display old cached
versions. If I refresh the page, I get the correct cached version of all user
controls. The problem is only when a postback happens. For some reason on a
postback, the cached version returned does not take into account the
VaryByParam string. Below is code explaining this.

Why would postback cause the cache to return back invalid version ?

Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="" %>
<%@ Register src="WebUserControl1.ascx" tagname="WebUserControl1"
tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd...
<html xmlns="http://www.w3.org/1999/x... >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<uc1:WebUserControl1 ID="WebUserControl11" runat="server"
EnableViewState="false" />
</form>
</body>
</html>

WebUserControl1.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="" %>
<%@ OutputCache Duration="3600" VaryByParam="MenuID" %>
Cache time: <%= DateTime.Now.ToString()%>
<br /><br />
<asp:LinkButton ID="test" runat="server" Text="PostBack"></asp:LinkButton>
<br /><br />
<a href="Default.aspx?menuid=1">1</a> - <a
href="Default.aspx?menuid=2">2</a> - <a href="Default.aspx?menuid=3">3</a>
<br /><br />
MenuID: <%= Request.QueryString["MenuID"] != null ?
Request.QueryString["MenuID"].ToString() : "null" %>

1 Answer

Keith Thompson

10/21/2009 8:20:00 PM

0

Kenneth Brody <kenbrody@spamcop.net> writes:
> Keith Thompson wrote:
>> Andy <whereasme@gmail.com> writes:
>>> I was wondering how to compile an int into 64bit mode in a 64 bit
>>> machine with gcc. Seems by default the int is treated as 4bytes.
>>
>> There may or may not be a way to cause the compiler to use 64 bits
>> for type int. Consult your gcc documentation.
>>
>> Note that if int is 64 bits, and char is 8 bits, then short is
>> probably either 16 bits or 32 bits; either there's no 16-bit
>> predefined type, or there's no 32-bit predefined type (unless the
>> implementation provides extended integer types).
> [...]
>
> Could the implementation "make up" its own types, and have int16_t and
> int32_t be 16- and 32-bits, even in the above scenario?
>
> ie:
>
> char = 8 bits
> short = 16 bits
> something_else = 32 bits
> int = 64 bits
> and
> int16_t = short
> int32_t = "something_else"
> int64_t = int

Yes, as I mentioned an implementation can provide "extended integer
types" as described in C99 6.2.5, and int32_t et al can be typedefs
for these types.

I'm not aware of any implementation that has done so.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.ne...
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"