0

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)

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by bharanidharanit
0

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
0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.