﻿
Partial Class main
    Inherits System.Web.UI.MasterPage
    Public PageName As String = ""

    Private Sub form1_Load(sender As Object, e As EventArgs) Handles form1.Load

        If IsNothing(Session("REP_ID")) Then
            Session("REP_ID") = 0
        End If

        PageName = IO.Path.GetFileName(Request.PhysicalPath).ToLower
        Session("Key") = ConfigurationManager.AppSettings("KEY").ToString
        If Not Page.IsPostBack Then
            If IsNothing(Session("userid")) Then
                Response.Redirect("login.aspx")
            ElseIf PageName <> "profile.aspx" Then 'Not on the Profile Page
                If String.IsNullOrEmpty(Session("DSVAccount")) Then
                    Response.Redirect("profile.aspx")
                End If
            End If
        End If
    End Sub

End Class

