Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

How to redirect on required page based upon role

$
0
0

I want to redirect on the user and admin page based upon role.what code should i write for this


public partial class Login : System.Web.UI.Page
{

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ABCNETConnectionString8"].ConnectionString);

protected void Page_Load(object sender, EventArgs e)
{
}

protected void Loginnewpage_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Membership.ValidateUser(Loginnewpage.UserName, Loginnewpage.Password) == true)
{

Loginnewpage.Visible = true;
Session["user"] = User.Identity.Name;
FormsAuthentication.RedirectFromLoginPage(Loginnewpage.UserName, true);
Response.Redirect("~/Admin/Admin.aspx")
}
else
{
Response.Write("Invalid Login");
}
}
}


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>