Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two Login Pages Directing to Different Default Pages 1

Status
Not open for further replies.

ashw

MIS
Jun 10, 2002
61
CA
Hi everybody,
I am developing a website by using ASP.NET and with SQL Server database. Please I need to know this fast.I have a question. I have two Login pages, Login.aspx (For members) AdminLogin.aspx for (Administrators)
I want Login.aspx to direct to Default.aspx (after entering correct password and username)and AdminLogin.aspx to direct to AdminDefault.aspx (after entering correct password and username). How do I achieve that? I am new to asp.net, I will apreciate ur help. Thanks
ash
 
I think maybe some additional information is needed but I'll give you a description of how I think I would approach this with my current understanding of the problem.

This was not mentioned in the above so the following assumes that the user (Member and Admin) information is stored in a SQL table.

Since both members and Admins must log in, I would use one login page. In the user information table I would use a boolean flag denoting whether a user is an Admin or a Member. If there are additional types of users you would want to use a seperate table linked by an integer value to the user information table.

When a user logs in check to see if the boolean flag for "Admin" is true. If it is redirect to "AdminLogin.aspx " else redirect to "Default.aspx ".

Let me know if I missed the point.

Rich
 
Hi,
Thanks for replying fast. I need to have two login pages with default pages for each.I want the AdminLogin.aspx to direct to AdminDefault.aspx. This page has access to certain facilities not available to a member. Also I am coding the the password and user name in the form for AdminLogin.aspx. For the members login page that is , Login.aspx I am checking the passwords from the database and then directing it to Default.aspx which has limited facilities. I will appreciate your prompt reply. Thank you.
Ash
 
To direct to another page for the members you can do:
Code:
Response.Redirect("Default.aspx")
and the same for the Admins, only a different page.
 
Hi,
Where do I code Response.redirect(AdminDefault.aspx)
I have written the following code in AdminLogin.aspx:


<script language=&quot;C#&quot; runat=server>
void AdminLogin_Click(Object Src, EventArgs E)
{
if (Page.IsValid)
{
if(txtAdminEmail.Text ==&quot;master@bondo.ca&quot; && txtAdminPwd.Text == &quot;secret&quot;)
FormsAuthentication.RedirectFromLoginPage
(txtAdminEmail.Text,false);
else
lblAdminLoginMsg.Text = &quot;Invalid Login. Please Try again.&quot;;
}
}
</script>
 
The .NET framwork provides form based authentication built in. heres a google search result...


There are some really good resources with tutorials for setting this up. By using different web.config files for different directories you can specify differing permissions, users and credentials and login pages for the directories. All ongoing identity management is handled by the framework and there are lots of handy features like atoumatically redirecting to the requested page from the login page on completion.

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top