T
tshad
I created a User Control that just does some VB code and doesn't have any
HTML in it.
Mainly it is an initialization piece that I want to put on all my pages. It
just has this code:
***************************************************
<script runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
if not IsPostBack
if session("LoggedIn") <> nothing then
if session("firstName") <> nothing then
UserLoggedOn.Text = UserLoggedOn.Text & session("firstName")
if session("lastName") <> nothing then
UserLoggedOn.Text = UserLoggedOn.Text & " " & session("lastName")
end if
end if
UserLoggedOn.visible = true
UserLoggedOnLabel.visible = true
end if
if (Session("User") is nothing) orelse (Session("User").CompanyID is
DBNull.Value)
response.Redirect("/PageUnavailable.aspx")
end if
end if
End Sub
</script>
*********************************************************************
Do I still have to put the it in the HTML code section of my Web page?
Or can I just call it somehow from the Page_Load section of each page?
Thanks,
Tom
HTML in it.
Mainly it is an initialization piece that I want to put on all my pages. It
just has this code:
***************************************************
<script runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
if not IsPostBack
if session("LoggedIn") <> nothing then
if session("firstName") <> nothing then
UserLoggedOn.Text = UserLoggedOn.Text & session("firstName")
if session("lastName") <> nothing then
UserLoggedOn.Text = UserLoggedOn.Text & " " & session("lastName")
end if
end if
UserLoggedOn.visible = true
UserLoggedOnLabel.visible = true
end if
if (Session("User") is nothing) orelse (Session("User").CompanyID is
DBNull.Value)
response.Redirect("/PageUnavailable.aspx")
end if
end if
End Sub
</script>
*********************************************************************
Do I still have to put the it in the HTML code section of my Web page?
Or can I just call it somehow from the Page_Load section of each page?
Thanks,
Tom