Thursday, March 22, 2012

login location path

In my web config file for a login system using credential from a database I have the following line:

<location path="default.aspx">

I want the logged in user to be redirected to a page in the same folder as the login page: 'Admin'.

However changing the above path to:


<location path="Admin/default.aspx">

does not have the desired effect and when the login page is used, I am redirected to the 'default.aspx' page in the root of the app, not in the Admin folder in the app.

Can anyone advise me of how this is accomplished. Thanks in advance.Hello, what you can do is either one of those two ways:
1-
don't use the methods RedirectFromLogin, just use the Redirect method to the page you want, once the user is authenticated.

2-
if you still want to use the RedirectFromLogIn, place a redirect statement in the default.aspx page to the page you want of your own.

regards
Hi Haidar,
Thanks for your reply. I'd like to follow the redirect route (1) I don't like the idea of having page redirects etc (method 2).

I've put together the code below which does what I want at the moment:


Sub Login_Click(Scr As Object, E As EventArgs)
if dsLogin.RecordCount > 0 then
Response.Redirect ("Admin/loggedInDefault.aspx")
Else
Response.Redirect ("Admin/loginFail.aspx")
End If
End Sub

Can you tell me if this is good practice ? Is this the best way to manage a login system ? Also, can you tell me if there is any benefit to using a stored procedure in my database to handle logins ? I 've read about this and wonder if this is an even better way to handle user logins ? I want a scaleable method that could manage user roles and levels at some stage.

Really appreciate any comments you have.

0 comments:

Post a Comment