我有一个流程,从技术上讲,我有2个地址,但它显示为3个不同的页面。
我想要的:
我希望用户能够从屏幕3(会员详细信息)返回到会员搜索结果,甚至会员搜索。但是,当他们返回到会员搜索时,我希望在字段中键入的所有信息都消失。
我尝试使用缓存执行此操作,但是当我从屏幕3转到屏幕2时,它失败并显示以下内容:
网页已过期
代码:(资格/default.aspx.cs):
protected void Page_Load(object sender, EventArgs e) {
.....
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
protected void lnkSearch_Click(object sender, EventArgs e)
{
ShouldSearch = false;
litError.Text = "";
ClearAllSearchInputVars();
// Member ID
if (!string.IsNullOrEmpty(tbSearchMemberID.Text))
Search_MemberID = tbSearchMemberID.Text;
tbSearchMemberID.Text = ""; // clear field after clicking search
protected void ClearAllSearchInputVars()
{
Search_MemberID = "";
Search_MemberFirstName = "";
Search_MemberLastName = "";
Search_DateOfBirth = "";
Search_Gender = "";
}
protected void LoadMember(string memberID, string memberSequenceID = null)
//protected void LoadMember(int memberID, string memberSequenceID=null)
{
tbSearchMemberID.Text = ""; //may just want to set text to Empty String like this
tbDateOfBirth.Text = "";
tbSearchMemberLastName.Text = "";
if (string.IsNullOrEmpty(memberSequenceID))
Response.Redirect(String.Format("/members/member-detail/{0}", memberID));
else
Response.Redirect(String.Format("/members/member-detail/{0}/{1}", memberID, memberSequenceID));
}
我看到了在SO上的许多解决方案中使用了它,因此似乎应该是需要的。如果页面上有多个屏幕,是否可以不使用此缓存功能?