Hi Peter,
Thanks so much for your reply. The code is as follows:
My glabal.asax file contains the following:
Sub Session_Start(Sender As Object, E As EventArgs)
Dim strTourCode As String
Session("TourCode") = strTourCode
End Sub
My page content is as follows:
<%@ Page Language="
VB" Debug="True" %>
<%@ Register TagPrefix="DTW" TagName="HeadFoot" Src="/NEWDTW/commonfiles/headfootPanel.ascx" %>
<%@ Register TagPrefix="DTW" TagName="Destination" Src="/NEWDTW/commonfiles/destPanel.ascx" %>
<%@ Register TagPrefix="DTW" TagName="Left" Src="/NEWDTW/commonfiles/leftPanel.ascx" %>
<%@ Register TagPrefix="DTW" TagName="Right" Src="/NEWDTW/commonfiles/rightPanel.ascx" %>
<script language="
VB" runat="server">
Sub Page_Load()
Dim strPath As String = Page.Request.Path
Dim intStart As Integer = strPath.LastIndexOf("/") - 2
Dim intLength As Integer = 2
Dim strNewString As String = strPath.Substring(intStart,intLength)
If Session("TourCode") <> strNewString Then
Session("TourCode") = strNewString
End If
End Sub
</script>
<!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>
<title>New Template</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form runat="server">
<DTW:HEADFOOT id="headfootPanels" runat="server"></DTW:HEADFOOT>
<DTW:DESTINATION id="destPanel" runat="server"></DTW:DESTINATION>
<DTW:LEFT id="leftBoxes" runat="server"></DTW:LEFT>
<DTW:RIGHT id="rightBoxes" runat="server"></DTW:RIGHT>
</form>
</body>
</html>
The DTW:DESTINATION user control contains two custom controls that call the Session variable (ie, one creates a breadcrumb, the other creates a tour header). The DTW:LEFT also contains one custom control (which creates links to other relevant tours). Hence, all three need the most recent session variable.
When looking at the "Page Lifecycle" I thought that the Page gets initialized first, hence I tried to update the session variable first in the Page_Init() thinking that thought would occur before any of my controls (which call the session variable) are rendered? When this didn't work, I tried the Page_Load(), but it had the same result.
Apologies for not thinking earlier to include the code. I haven't included the code for the custom controls, I hope this isn't a problem (they're kinda long). Also apologies for any delay in replying - it's the time difference.
Thank you for your help once again.