Forum Moderators: open
The routine works, but I want to have a fixed target after validation, not "the page it was attempting to access".
I want a button to the login page, then have the login page either redirect to a "sorry" or a "welcome" page. It always seems to want to go somewhere else.
In classic ASP I just checked for a Session variable at the top of every page and redirected to login if it wasn't there. But that defeats the purpose of using the webconfig authentication, right?
Kind of leads me back to the post below about "why bother with .NET?"
If you are using the RedirectFromLoginPage method it automatically creates the authentication cookie. What you can do is create the cookie yourself and then redirect to any page that you want to.
also if you notice the "ReturnURL" querystring parameter on your login page....if you can find a way to override that then you can make the default RedirectFromLoginPage go anywhere you want.
Also, you could also make your login page the welcome and sorry all in one if you wanted by by displaying/hiding certain panels based on the success of the users login attempt.
it is kind of like having a navigation computer in your car...if you don't know how to use it then you'll always think it is easier to just read a map while you are driving.
Where can I specify what the redirect URL is?
So I wrote this instead: End If
If DB.LoginMethod(uname.Text, pwd.Text) Then
Response.Redirect("home.aspx")
Else
' Invalid credentials supplied, display message
lblNG.Text = "Incorrect username or password, please try again or contact our office."
but it still picks up the ReturnUrl Parameter in there and doesn't redirect.
http://localhost/test3/login.aspx?ReturnUrl=%2ftest3%2fhome.aspx
I don't see a way to override the exisiting FormsAuthentication methods