Get whether the session was created only for the current request or not
IsNewSession.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, System.EventArgs e) {
Session["ZipCode"] = "12345";
Label1.Text = "Session read<br />";
Label1.Text += "Session IsNewSession?: " + Session.IsNewSession;
Label1.Text += "<br />Zip Code :" + Session["ZipCode"];
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>asp.net session IsNewSession example: how to get whether the session was created only for the current request or not</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Blue">asp.net session example: Session IsNewSession?</h2>
<asp:Label
ID="Label1"
runat="server"
Font-Size="Large"
ForeColor="OrangeRed"
>
</asp:Label>
</div>
</form>
</body>
</html>
- How to cancel the current session and release all from memory in asp.net
- How to submit a page to another page in asp.net
- How to remove an item from session in asp.net
- How to remove all keys and values from the session-state collection in asp.net
- How to get session time out value in asp.net
- How to use ViewState in asp.net
- How to read data from ViewState in asp.net
- How to store data in ViewState in asp.net