I am building a website on an intranet and one of the directories can only be accessed by hard coded authorized users. They are defined in web.config. It looks similar to this.
<location path="admin">
<system.web>
<authorization>
<allow users="user1"/>
<allow users="user2"/>
<allow users="user3"/>
<allow users="user4"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
What I want then is to create a link to this directory which only appears to those users... At the moment, to build the link I'm rechecking there windows usernames and hard coding them in again like this...
<%
if (HttpContext.Current.User.Identity.Name == "user1" ||
HttpContext.Current.User.Identity.Name == "user2" ||
HttpContext.Current.User.Identity.Name == "user3" ||
HttpContext.Current.User.Identity.Name == "user4")
{
Response.Write("<a href='admin/Default.aspx'>Admin Site</a>");
}
%>
But what I want to do is reference my list from the webiconfig file and say something like
if (HttpContext.Current.User.Identity.Name == // a user from the web.config list
Is this possible and if so can you help me... Thanks