I'm new to ASP.NET and I am designing a warehouse portal. It has three users: admin, warehouse staff and customer service. I designed an adduser.aspx page where I add users and assign roles. I use dropdown list to select the type of user and then store the value in database. After creating all users I set my login page as default and after validation, redirect them to specific pages. This is how I do it:
if (displayusertype.Equals("Admin"))
{
Session["user"] = loginusername.Text;
Response.Redirect("Admin_Default.aspx");
}
if (displayusertype.Equals("Warehouse staff"))
{
Session["user"] = loginusername.Text;
Response.Redirect("Warehousestaff_Default.aspx");
}
if (displayusertype.Equals("Customer service"))
{
Session["user"] = loginusername.Text;
Response.Redirect("Customerservice_Default.aspx");
}
If I go to the Admin_Default.aspx directly from browser I can access it. But I want only the admins to access this page. Similarly for warehouse staff and customer representatives. I only want the page which is redirect to, after a login and not simply through a browser. How can i achieve it?