after login always go default page
-
I have my login page using user.authentication when everytime i login, it will go to default page. How to make it when I login, it go back to the page itself. Mean if now i at page1.aspx and I didnt login, so a login form will pop up requeir I to login. After login I want my page to show the page1.aspx but not go to default.aspx Sub Authenticate(ByVal Sender As [Object], ByVal e As EventArgs) Dim u_id As Integer = DBAuthentication(txtUsername.Text, txtPassword.Text) Dim cookie As HttpCookie = FormsAuthentication.GetAuthCookie(txtUsername.Text, chkPersistCookie.Checked) If u_id > 0 Then FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, True) cookie.Expires = DateTime.Now.AddDays(14) Response.Cookies.Add(cookie) Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUsername.Text, chkPersistCookie.Checked)) Else lblMessage.Text = "This login doesn't exits.
" + "Please check your username/password.
" End If End Sub -
I have my login page using user.authentication when everytime i login, it will go to default page. How to make it when I login, it go back to the page itself. Mean if now i at page1.aspx and I didnt login, so a login form will pop up requeir I to login. After login I want my page to show the page1.aspx but not go to default.aspx Sub Authenticate(ByVal Sender As [Object], ByVal e As EventArgs) Dim u_id As Integer = DBAuthentication(txtUsername.Text, txtPassword.Text) Dim cookie As HttpCookie = FormsAuthentication.GetAuthCookie(txtUsername.Text, chkPersistCookie.Checked) If u_id > 0 Then FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, True) cookie.Expires = DateTime.Now.AddDays(14) Response.Cookies.Add(cookie) Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUsername.Text, chkPersistCookie.Checked)) Else lblMessage.Text = "This login doesn't exits.
" + "Please check your username/password.
" End If End Sub