i have the following table in my database.
table name :logintbl
type, username,password
column type has to values only, either "admin" or "user"
so that if username with type "admin" logged in then redirect to adminpage.aspx
and if username with "user" type logged in, redirects to userpage.aspx
the following code work fine for username and password authentication, so how do i modify to apply my above idea. thanks
Code:
con = New SqlConnection("server=(local); Data Source=gig;Initial Catalog=mydb;User ID=sa;Password=test")
        str = " select username,password from logintbl"
                cmdadapter = New SqlDataAdapter(str, con)
        ds = New DataSet
        cmdadapter.Fill(ds, "logintbl")
        Try
            con.Open()
            For Each dr In ds.Tables(0).Rows
                If (dr(0) = usernametxt.Text And dr(1) = passwordtxt.Text) Then
                    Session("userloggedin") = usernametxt.Text
                                        
                    Response.Redirect("addvacancy.aspx", False)
                    temp = True
                                            
                Else
                    lbllogin.Text = " Sorry... try again,invalid username or password"
                    lbllogin.Font.Bold = True
                    lbllogin.ForeColor = Drawing.Color.Red
                       
                End If
                
            Next
        
        Catch ex As Exception
            con.Close()
        End Try