Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've got this login control which helps the users to login, The problem is that I want the admin also to use the same login control to login and be redirected toa different page..Is there any way i can do that?
Thank you :D
Posted

Add a column to user table with column Name 'UserType'. Save values like 'A'/'U'.
where A - Admin User
U - Normal User

Now when user login, add a check on UserType like

C#
if(UserType == "A")
{
response.redirect("Admin Page Url");
}
else
{
response.redirect("User Page Url");
}
 
Share this answer
 
I got it,Thank you anyways :),well actually i was using the inbuilt login control of asp.net C# so i had to create roles to make it work in 2 different scenarios the user and admin.I placed a linkbutton and made it visible only at admins login to redirect him to admin page.
HTML
protected void Page_Load(object sender, EventArgs e)
    {
        if (User.IsInRole("admin"))
        {
            LinkButton3.Visible = true;
        }
        else
        {
            LinkButton3.Visible = false;
        }
    }
 
Share this answer
 
Refer

without login control


http://www.aspdotnet-suresh.com/2011/12/how-to-create-simple-login-form-using.html[^]

or

with login control

http://www.aspdotnet-suresh.com/2012/01/aspnet-login-control-to-check-user.html[^]


on btn Click

if(txtusername.text == "admin")
{
response.redirect("~/admin.aspx");
}
else
{
response.redirect("~/user.aspx");
}
 
Share this answer
 
v2
Hey Hi,
I under stood your problem... Basically u have two types of logins
1) Admin Login
2) User Login

Here first when the user clicks on the Login button u will verify whether the user details exist in the database or not.... At that time bring a value from a DataBase whether he is admin or user then basing on that write a if condition


if(type=="Admin")
{

//Redirect to Admin pages

}
else if(type="User")
{

//Redirect to user pages

}
 
Share this answer
 
 
Share this answer
 
You can check for UserName also
If User Name is Admin u can directly redired to diff page
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900