protected
void SetDestinationUrl(object sender, EventArgs e)
{
TextBox txtBox = (TextBox)LoginUser.FindControl("UserName"); if (Roles.IsUserInRole(txtBox.Text, "Guest"))
{
Response.Redirect(
"UserIndex.aspx");
if (Roles.IsUserInRole(txtBox.Text, "Administrator"))
{
Response.Redirect(
"AdminIndex.aspx");
}
}
The above code is showing me error by saying "The type or namespace anme IsUserInRole does not exist....."
Kindly help me out of it..

Sandeep Singh ShekhawatRank #147 · 15.6K pointsPosted Oct 13, 2012, 5:05 AM EDT
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Security; namespace Supportticketsystem.Account { public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void SetDestinationUrl(object sender, EventArgs e) { TextBox txtBox = (TextBox)LoginUser.FindControl("UserName"); if (Roles.IsUserInRole(txtBox.Text, "Guest")) { Response.Redirect("UserIndex.aspx"); if (Roles.IsUserInRole(txtBox.Text, "Administrator")) { Response.Redirect("AdminIndex.aspx"); } } } } }Its running successful on my system please chaeck inherits attribute on .aspx page under page directive.
Inherits="Supportticketsystem.Account.Login"
Sandeep Singh ShekhawatRank #147 · 15.6K pointsPosted Oct 13, 2012, 4:38 AM EDT
using System.Web.Security;
Sheikh parvaz184 pointsPosted Oct 13, 2012, 4:39 AM EDT
Sheikh parvaz184 pointsPosted Oct 13, 2012, 4:44 AM EDT
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.Security;
namespace
Supportticketsystem.Account
{
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SetDestinationUrl(object sender, EventArgs e)
{
TextBox txtBox = (TextBox)LoginUser.FindControl("UserName"); if (Roles.IsUserInRole(txtBox.Text, "Guest"))
{
Response.Redirect(
"UserIndex.aspx");
if (Roles.IsUserInRole(txtBox.Text, "Administrator"))
{
Response.Redirect(
"AdminIndex.aspx");
}
}
}
}
}
This is the whole program.
Sheikh parvaz184 pointsPosted Oct 13, 2012, 5:11 AM EDT