Hi urt,
Sorry for the late response. My code is as the followings. There are two pages, WebForm1.aspx and WebForm2.aspx. I received an error message "Warning: Page has expired, The page you requested was created using information you submitted in a form...." if I selected one of those selections in the dropdown box and clicked on the link button "View WebForm2 then clicked on "Return to WebForm1" on WebForm2. In order to link it back to the previous page, WebForm1 successfully, the solutions are either I remove HTML Input (I can't do that for business reason) or I remove autopostback in the dropdown box. (I might do that if it is the only solution). So, my question is how I can clear the postback in window.history or change the page id or something in window.history. Thanks.
WebForm1.aspx
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="PageHasExpired.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
.....
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<div>
<tr>
<td><asp:hyperlink id="hypReturn" NavigateUrl="javascript: window.history.go(-2)" CssClass="hyplink"
Runat="server">< Return to WebForm1</asp:hyperlink></td>
</tr>
<br>
<br>
<tr>
<td><asp:dropdownlist id="ddlTrialBatchPoint" runat="server" AutoPostBack="True">
<asp:ListItem>Select one</asp:ListItem>
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:dropdownlist></td>
</tr>
<br>
<br>
<tr>
<td>
<asp:LinkButton id="lnkViewPage2" onclick="lnkViewPage2_Click" runat="server" CssClass="hyplink">View WebForm2</asp:LinkButton></td>
</tr>
<br>
<br>
<tr>
<td>
<input id="fileName" type="file" size="20" runat="server"></td>
<td><asp:requiredfieldvalidator id="reqFileName" runat="server" ErrorMessage="* File name Required" EnableClientScript="False"
ControlToValidate="fileName"></asp:requiredfieldvalidator></td>
</tr>
</div>
</form>
</body>
</HTML>
WebForm1 code behind:
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
protected void lnkViewPage2_Click(object sender, System.EventArgs e)
{
Server.Transfer("WebForm2.aspx");
}
WebForm2.aspx
<form id="Form1" method="post" runat="server">
<div>
<tr>
<td><asp:hyperlink id="hypReturn" Runat="server" NavigateUrl="javascript: window.history.go(-1)">< Return to WebForm1</asp:hyperlink>
</td>
</tr>
<tr>
<td><p><b>Page 2 data.</b></p>
</td>
</tr>
</div>
</form>
WebForm2 - no code behind.
ching
|