This namespace required when the user logs in to the Web site and need to be authenticated for a valid or non-valid user.
System.Web.UI.WebControls
by using OnLoggedIn eventhandler we can rediect different users to different aspx page.
<asp:Login OnLoggedIn="EventHandler" /> <asp:Login ID="myLogin" runat="server" OnLoggedIn="Login_LoggedIn">
For Example :
protected void Login_LoggedIn(object sender, EventArgs e)
{
if (Roles.IsUserInRole(myLogin.UserName, "RoleOne"))
{
Response.Redirect("~/PageOne.aspx");
}
if (Roles.IsUserInRole(myLogin.UserName, "RoleTwo"))
{
Response.Redirect("~/PageTwo.aspx");
}
if (Roles.IsUserInRole(myLogin.UserName, "RoleThree"))
{
Response.Redirect("~/PageThree.aspx");
}
}
No comments:
Post a Comment