Click here to Skip to main content
11,705,763 members (46,131 online)
Rate this: bad
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 4.0
Posted 2-Oct-12 23:59pm
Anuja Pawar Indore at 3-Oct-12 6:36am
Why repost? Update your previous question
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

for your requirements, i'm giving the simplest solution,

i guess u have newusertbl with columns username, password and usertype. The value of the column usertype should be either 'Admin' or 'Executive'. Also, ur dropdownlist has the values 'Admin' and 'Executive'.

in Login button click evt. use the following code:

protected void LoginBtn_Click(object sender, EventArgs e)
string qry = string.Empty;
qry = "select userType from NewUserTbl where username='" + TextBox1.Text.Trim() + "' and password='" + TextBox2.Text.Trim() + "'";
SqlConnection testDBConnection = new SqlConnection("Data Source=.;Initial Catalog=TestDb;Integrated Security=True");
SqlCommand cmd = new SqlCommand(qry, testDBConnection);
string userType = Convert.ToString(cmd.ExecuteScalar());
if (string.IsNullOrEmpty(userType))
Response.Write("Invalid username or Password");
else if (RoleDDL.SelectedItem.Text == "Admin" && userType == "Admin")
else if (RoleDDL.SelectedItem.Text == "Executive" && userType == "Executive")

TextBox1 is username TextBox,
TextBox2 is Password TextBox,
RoleDDL is the Dropdownlist.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

then what is your question ? where u facing problem pls explain your particular problem ?

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

  Print Answers RSS
0 OriginalGriff 218
1 Sergey Alexandrovich Kryukov 170
2 Inimicos 60
3 ProgramFOX 50
4 Richard MacCutchan 45
0 OriginalGriff 9,037
1 Sergey Alexandrovich Kryukov 8,417
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,626

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