<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
...etc...
<system.web>
<authentication mode="Windows" />
<authorization>
<allow roles="MYDOMAIN\MyAppUsers" />
<deny users="*" />
</authorization>
</system.web>
</configuration>// This redirects people without access to the noaccess.htm page
protected void Application_EndRequest(Object sender, EventArgs e)
{
HttpContext context = HttpContext.Current;
if (context.Response.Status.Substring(0, 3).Equals("401"))
{
context.Response.ClearContent();
context.Response.Write("<scr" +
"ipt language=javascript> self.location='noaccess.htm'; </sc" +
"ript>");
}
}HttpContext.Current.Request.ServerVariables["AUTH_USER"];
literalLoggedOnUser.Text = HttpContext.Current.Request.ServerVariables["AUTH_USER"];
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="AdminGroup" value="MYDOMAIN\MyAppAdmins"/>
</appSettings>
...etc...
</configuration>string group = ConfigurationManager.AppSettings["AdminGroup"];
if (User.IsInRole(group))
{
// this user is an administrator
}
else
{
// this user is a common pleb
}Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.

(Comp Sci, Hons - UTS)
Software Developer (Freelancer / Contractor) in Australia.
I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!
Get in touch:
[email protected]
github.com/chrishulbert
linkedin