Below is the code example to cache multiple version of the single web form based on any change in querystring paramete using VaryByParam attribute of OuputCache directive
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Excache2.aspx.cs" Inherits="Excache2" %>
<%@ OutputCache Duration="300" VaryByParam="*" %>
<HTML>
<body>
<form id="Form1" method="post" runat="server">
<h2>Caching Multiple Versions of a Web Form</h2>
<hr>
<p> When user is redirected from some page to this form based on any change
in query string parameter different versions of this web form will be cached
</form>
</body>
</HTML>
for example
////////////////////////////////////////////////////////// GET/excache2.aspx?id=1 - one version cached for id=1
GET/excache2.aspx?id=2 - one more version cached for id=2
No comments:
Post a Comment