Click here to Skip to main content
12,946,164 members (49,964 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am create NewUser Table, and Login Page.

I have Login page, in that login page 1)UserName(txtbox1),2)Password(txtbox2),3)UserType In DropDownList(Admin/Executive) & Login Button.

When I click Login Btn , it will check username,pass,usertyper( if I chooes "Admin")so as per DB (NewUser Tbl) and redirect the page in Admin(Folder)--->Home.aspx(Its Belog to Master Page), similar for Execute if i chooes "Executive" check username & pass and page redirect to Executive(Folder)--->Home.aspx other wise give invalid pass & username. plz solustion as per 4.0
Posted 2-Oct-12 23:58pm
Tejas Vaishnav 3-Oct-12 6:31am
Have you tried something..
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


You can write code as below.

string usreType = DropDownList.SelectedItem.Value;
//Validate and authenticate user 
bool IsValidUser = //validate user form db with user name, password and user type
     case : "Admin" //Redirect user to Admin folder
     case : "Executive " //Redirect user to Executive folder
   //show error message as not valid user

The best way to implement this senario is to first validate user with user name and password. And then validate type of user with user name and password. By using this technique you can display more appropriate error message.
Tejas Vaishnav 3-Oct-12 7:21am
that's what i want to tell... nice work Mohd. Mukhtar.
Mohd. Mukhtar 3-Oct-12 7:48am
Thanks :-)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

you can do something like this...

as you say on your login page you have two text boxes and one drop-down for selection of user type.

so if user select Admin from drop-down and enter his user name and password and if it will successfully login then you can redirect him to Admin\Home.aspx or if he/she will not successfully authenticated by username/password then refuse to login and stay on your login page. do same thing for Executive and redirect to Executive\Home.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,919
CHill60 3,235
Maciej Los 2,508
Jochen Arndt 1,935
ppolymorphe 1,795

Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 3 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100