Hi,
I'm trying to redirect the admin user from my login.aspx page to the admin.aspx page and any other domain user to the default.aspx page. I have no problems getting the domain users redirecting or having a message displayed when the credentials are incorrect, however when I enter the admin details in the page doesn't redirect and just returns to the login.aspx page again. Is the something I'm doing wrong or is this not possible to have a user authenticate that isn't a domain user? My backend C# file is attached which shows what happens when the logon button is clicked.
Thanks
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void AuthenticateLogin(object sender, EventArgs e)
{
try
{
String _username = username_tb.Text;
String _pasword = password_tb.Text;
if (_username == "admin" && _pasword == "password")
{
Response.Redirect("admin/default.aspx");
}
else if (Membership.ValidateUser(_username, _pasword))
{
errors_bl.Items.Clear();
Response.Write("Valid user");
FormsAuthentication.RedirectFromLoginPage(_username, false);
Response.Redirect("default/default.aspx");
}
else
{
username_tb.Text = "";
lblError.Visible= true;
}
}
}