Hello,
I am having 3 pages default.aspx, default1.aspx and default2.aspx
Default.aspx is the home page.
When i click default2.aspx, it must check whether i have logged in, if not it must redirect to a login page(default1.aspx)

Hello,
I am having 3 pages default.aspx, default1.aspx and default2.aspx
Default.aspx is the home page.
When i click default2.aspx, it must check whether i have logged in, if not it must redirect to a login page(default1.aspx)

You may use session to check your user id

Public Function CheckValidation(ByVal UserId As String) As Boolean
        CheckValidation= False
        If UserId = "" Then            
            Exit Function
        End If
        CheckValidation= True
    End Function

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If  CheckValidation(Session("UserID")) = False Then
            Response.Redirect("../../Others/Sorry.aspx")
            Exit Sub
        End If           
    End Sub

You may use session to check your user id

Public Function CheckValidation(ByVal UserId As String) As Boolean
        CheckValidation= False
        If UserId = "" Then            
            Exit Function
        End If
        CheckValidation= True
    End Function

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If  CheckValidation(Session("UserID")) = False Then
            Response.Redirect("../../Others/Sorry.aspx")
            Exit Sub
        End If           
    End Sub

Hello,
I am not using any user controls such as login control. I simply made a login with simple codings. By comparing the textbox values with database the user will log in. Now how the UserID will work. How to do this?

This article has been dead for over six months. Start a new discussion instead.