私のweb.configには次のものがあります:
<appSettings>
<add key="webpages:Enabled" value="false" />
<add key="authorizedUsers" value="jeff,jason,bob"/>
</appSettings>
私の _Layout.cshtml には、次のものがあります。
@{
List<String> authList = new List<string>();
authList = System.Web.Configuration.WebConfigurationManager.AppSettings["authorizedUsers"].Split(',').ToList();
if (authList.Any(u=>u == this.User.Identity.Name))
{
<li>@Html.ActionLink("Admin", "Index", "Admin")</li>
}
}
これを実行すると、これをObject reference not set to an instance of an object.
機能させるために何をする必要がありますか?