|
protected void Page_Load(object sender, EventArgs e)
{
RolePrincipal p = (RolePrincipal)User;
string[] roles = p.GetRoles();
foreach (string s in roles)
{
Response.Write(s + "<br>");
}
if (HttpContext.Current.User.IsInRole("PurchaseAdmin"))
{
string url;
url = "~/Default1.aspx";
Response.Redirect(this.ResolveUrl(url));
}
}
运行时出以下错,以前我好像解决过,但重装操作系统后问题就解决不了.?????
错误如下:
无法将类型为“System.Security.Principal.WindowsPrincipal”的对象强制转换为类型“System.Web.Security.RolePrincipal”。 |
|