
April 17th, 2002, 08:29 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
Roles using windows authentication
<i><b>Originally posted by : William moore (will.moore@ntlworld.com)</b></i><br />This code dos not seem to be working when using windows authentication the if statment always evals to "FALSE" <br />I have included both the code and the web.config <br /><br /><br />__________________________________________________ __ <br /><br />Test.aspx file <br />-------------- <br /><html> <br /><br /><script language="C#" runat=server> <br /><br />void Page_Load(Object Src, EventArgs E ) { <br /><br />if(User.IsInRole("manager")) { <br /><br />AuthUser.Text = User.Identity.Name; <br />AuthType.Text = User.Identity.AuthenticationType; <br /><br />} <br /><br />else { <br />AuthUser.Text = "Access Denied"; <br />AuthType.Text = "Access Denied"; <br />} <br /><br /><br />} <br /><br /></script> <br /><br /><body> <br /><br /><h3><font face="Verdana">Using Windows Authentication</font></h3> <br /><br /><table Width="700" rules="all" bordercolor="Black" style="background-color:#ccccff;bordercolor:black;font-family:Verdana;font-size:8pt;border-collapse:collapse;"> <br /><tr> <br /><td>User:</td> <br /><td><asp:label id=AuthUser runat=server/> <br /></tr> <br /><tr> <br /><td>Authentication Type:</td> <br /><td><asp:label id=AuthType runat=server/> <br /></tr> <br /></table> <br /><br /></body> <br /><br /></html> <br />__________________________________________________ ___ <br /><br />web.config file <br />---------------- <br /><configuration> <br /><system.web> <br /><authentication mode="Windows" /> <br /><br /><globalization requestEncoding="UTF-8" /> <br /><br /></system.web> <br /></configuration> <br /><br />
|