T
tony collier
i have the of the following in my global.asax:
void Application_Start(Object Sender, EventArgs e)
{
Application["appname"]="";
}
void Session_Start(Object Sender, EventArgs e)
{
Session["sessname"]="";
}
I then have two pages:
session1.aspx
.....
void Page_Load(Object sender, EventArgs e)
{
string test1=(String)Application["appname"];
Response.Write(test1+"<BR>");
Application["appname"] = "changed";
string test2=(String)Session["sessname"];
Response.Write(test2+"<BR>");
Session["sessname"] = "changed";
}
</script>
<html>
<form><a href=session-test2.aspx>click</a></form>
</html>
and
session2.aspx
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
string test1=(String)Application["appname"];
Response.Write(test1+"<BR>");
Application["appname"] = "application";
string test2=(String)Session["sessname"];
Response.Write(test2+"<BR>");
Session["sessname"] = "session";
}
</script>
<html>
<form><a href=session-test1.aspx>click</a></form>
</html>
the application variable works fine and starts as "", then becomes
"changed " then "application" and carry's on toggling as i jump between
pages, but the session variable can only be read and doesn't write back
when i try to change it's value. As it starts as "" it is never
displayed. Can someone tell me what i am doing wrong. thanks
void Application_Start(Object Sender, EventArgs e)
{
Application["appname"]="";
}
void Session_Start(Object Sender, EventArgs e)
{
Session["sessname"]="";
}
I then have two pages:
session1.aspx
.....
void Page_Load(Object sender, EventArgs e)
{
string test1=(String)Application["appname"];
Response.Write(test1+"<BR>");
Application["appname"] = "changed";
string test2=(String)Session["sessname"];
Response.Write(test2+"<BR>");
Session["sessname"] = "changed";
}
</script>
<html>
<form><a href=session-test2.aspx>click</a></form>
</html>
and
session2.aspx
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
string test1=(String)Application["appname"];
Response.Write(test1+"<BR>");
Application["appname"] = "application";
string test2=(String)Session["sessname"];
Response.Write(test2+"<BR>");
Session["sessname"] = "session";
}
</script>
<html>
<form><a href=session-test1.aspx>click</a></form>
</html>
the application variable works fine and starts as "", then becomes
"changed " then "application" and carry's on toggling as i jump between
pages, but the session variable can only be read and doesn't write back
when i try to change it's value. As it starts as "" it is never
displayed. Can someone tell me what i am doing wrong. thanks