Click here to Skip to main content
12,402,202 members (70,278 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
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 asp.net 4.0
Posted 2-Oct-12 23:58pm
Comments
Tejas Vaishnav 3-Oct-12 6:31am
   
Have you tried something..
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi,

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
if(IsValidUser)
{
   switch(userType)
   {
     case : "Admin" //Redirect user to Admin folder
     break;
     case : "Executive " //Redirect user to Executive folder
     break;
   }
}
else
{
   //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.
  Permalink  
v3
Comments
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
 
good
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
  Permalink  

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


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 3 Oct 2012
Copyright © CodeProject, 1999-2016
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