M
Magnus
Hello,
I am trying to set a session parameter in a second page, and then navigate
back to my first page, and use the session parameter.
I always have to press update to be able to use these.
Here is an example. First the code for the first page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!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/xhtml">
<head runat="server"><title>Untitled Page</title>
</head><body>
<form id="form1" runat="server">
<div><asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Button" /></div>
</form>
</body></html>
And from the codebehind:
protected void Page_Load(object sender, EventArgs e)
{Response.Write("<p>"+DateTime.Now+"</p>");}
protected void Button1_Click(object sender, EventArgs e)
{Response.Redirect("Default2.aspx");}
(The page default2.aspx can be empty for this example)
If you goto the first page, you see the time there. Then click the button,
to navigate to another page.
Then when clicking the back button in my browser (in this case IE7) I come
back to my first page, but no code seem to run (except javascript) since the
time is not updated. I can imagine this is by standard behavior, but is it a
way to make the code run even when using navigate back button?
Regards Magnus
I am trying to set a session parameter in a second page, and then navigate
back to my first page, and use the session parameter.
I always have to press update to be able to use these.
Here is an example. First the code for the first page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!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/xhtml">
<head runat="server"><title>Untitled Page</title>
</head><body>
<form id="form1" runat="server">
<div><asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Button" /></div>
</form>
</body></html>
And from the codebehind:
protected void Page_Load(object sender, EventArgs e)
{Response.Write("<p>"+DateTime.Now+"</p>");}
protected void Button1_Click(object sender, EventArgs e)
{Response.Redirect("Default2.aspx");}
(The page default2.aspx can be empty for this example)
If you goto the first page, you see the time there. Then click the button,
to navigate to another page.
Then when clicking the back button in my browser (in this case IE7) I come
back to my first page, but no code seem to run (except javascript) since the
time is not updated. I can imagine this is by standard behavior, but is it a
way to make the code run even when using navigate back button?
Regards Magnus