but doing it this way means, that users will see 2 pages where they have to choose from. One page that than show price1, one page for price2. The problem is that the users should not see that there are two different price modells.
yes, user1 has special privileges. I found a way to load 2 different pages.
Protected
Sub Login1_LoggingIn(ByVal sender
As Object,
ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs)
If (Membership.ValidateUser(Login1.UserName, Login1.Password))
Then
Response.Redirect(
"Price1.aspx")
Else
Response.Redirect(
"Price2.aspx")
End If
With this I am quite near. I can redirect to 2 different pages. What I am missing is that I can set that "Price1.aspx" will only be loaded when username is user1 with the specific password.
The code you wrote here will, redirect a user that is validated to Page1, else if the user could not be validated (either, the user does not exist, or the user inputted a wrong password) it will redirect them to Page2.
How will you specify if User1 has special privileges? Is User2 an anonymous user?? or is User2 and actual user without special privileges?
What I need to have is just a check that user1 will be redirected to side1. User1 should not know that there is existing a special side for user2, user3,..
User2 will be redirected after login to side2 and should not know aver the rest of the pages.
I thought that there is an easy way to just let the login module hook up the user in the db and than redirect them to the specific side. Perhaps it is possible to extend the table in the way
user1, password1, side1 ? In this case the login will search for the user, check the password and than redirect to the page?
chris_koehne
Member
8 Points
59 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 06:49 PM|LINK
AjPtl,
but doing it this way means, that users will see 2 pages where they have to choose from. One page that than show price1, one page for price2. The problem is that the users should not see that there are two different price modells.
Thanks, Chris
LuisE
Member
313 Points
89 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 06:58 PM|LINK
I completely understand what you are trying to do, but my question is how are you differentiating between User1 and User2??
Are you using roles?
chris_koehne
Member
8 Points
59 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 07:03 PM|LINK
LuisE
Member
313 Points
89 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 07:06 PM|LINK
Chris,
Can you explain how you determine which User sees which price?
-Luis
chris_koehne
Member
8 Points
59 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 07:13 PM|LINK
Luis,
I have a SQL database where the users an the passwords are stored in. Over web.config I configured to look into this db to authentificate the users.
<
authentication mode="Forms"/><
membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20"><
providers><
add connectionStringName="SqlServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordFormat="Hashed" applicationName="/" name="SqlProvider" type="System.Web.Security.SqlMembershipProvider"/></
providers></
membership>Is that what you are asking for?
Chris
LuisE
Member
313 Points
89 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 07:53 PM|LINK
Chris,
Ok, i understand that you have a SqlMembershipProvider, so you will need to use a RoleProvider, to differentiate between User1 and User2.
Can you also answer this question, For what reason are you going to show price1 for User1?
Does User1 have special privileges?
-Luis
chris_koehne
Member
8 Points
59 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 08:14 PM|LINK
Luis,
yes, user1 has special privileges. I found a way to load 2 different pages.
Protected
Sub Login1_LoggingIn(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs) If (Membership.ValidateUser(Login1.UserName, Login1.Password)) ThenResponse.Redirect(
"Price1.aspx") ElseResponse.Redirect(
"Price2.aspx") End IfWith this I am quite near. I can redirect to 2 different pages. What I am missing is that I can set that "Price1.aspx" will only be loaded when username is user1 with the specific password.
Chris
LuisE
Member
313 Points
89 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 08:30 PM|LINK
The code you wrote here will, redirect a user that is validated to Page1, else if the user could not be validated (either, the user does not exist, or the user inputted a wrong password) it will redirect them to Page2.
How will you specify if User1 has special privileges? Is User2 an anonymous user?? or is User2 and actual user without special privileges?
-Luis
chris_koehne
Member
8 Points
59 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 08:43 PM|LINK
They are all equivalent users. In the end I have just 5 users, not more. So in my database I have
user1, password1
user2, password2
user3, password3
user4, password4
user5, password5
What I need to have is just a check that user1 will be redirected to side1. User1 should not know that there is existing a special side for user2, user3,..
User2 will be redirected after login to side2 and should not know aver the rest of the pages.
I thought that there is an easy way to just let the login module hook up the user in the db and than redirect them to the specific side. Perhaps it is possible to extend the table in the way
user1, password1, side1 ? In this case the login will search for the user, check the password and than redirect to the page?
Chris
LuisE
Member
313 Points
89 Posts
Re: User Login redirect to differnet pages
Feb 26, 2007 08:55 PM|LINK
Chris,
In that case i would suggest using a RoleProvider.
-Luis