我有一个web表单,在后面的代码中包含以下内容:
Response.Clear();
Response.ContentType = "application/json; charset=utf-8";
int _pGID = base.GetParamAsInt("PGID");
if (_pGID > 0)
{
Response.Write(...);
}
else
{
Response.Write(...);
}
Response.End();和下面的标记:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PG.aspx.cs"
Inherits="PG" %>
<%@ OutputCache Duration="60" VaryByParam="PGID" %>问题是每次请求页面时都会触发page_load事件,即使QueryString 'PGID‘参数相同也是如此。
我遗漏了一些关于如何使用VaryByParam属性的东西?
发布于 2012-06-13 17:39:41
在中断代码并进行更多测试之后,似乎是对Response.End()的调用导致了这个问题。在一些文章中,Response.Flush()也会导致同样的问题。
https://stackoverflow.com/questions/11000199
复制相似问题