我设置日志elmah只能由两个特定用户访问

时间:2014-11-04 00:59:39

标签: c# elmah

我想只允许个人1和indivudal2访问我的elmah日志。这是我的配置:

<configSections>
    <sectionGroup name="elmah">
      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
      <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
      <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
    </sectionGroup>
</configSections>

<connectionStrings>
  <add name="Elmah.Sql" connectionString="Data Source=.\SQLEXPRESS2008R2;database=_dbL;Trusted_Connection=True" />
</connectionStrings>

<appSettings>
  <add key="webpages:Enabled" value="false" />
  <!-- ELMAH configuration. Admin page only available for logged in users in 
     the Admin role. -->
  <add key="elmah.mvc.disableHandler" value="false" />
  <add key="elmah.mvc.disableHandleErrorFilter" value="false" />
  <add key="elmah.mvc.requiresAuthentication" value="true" />
  <add key="elmah.mvc.allowedUsers" value="Individual1,Individual2" />
  <add key="elmah.mvc.route" value="elmah" />
</appSettings>

<elmah>
  <security allowRemoteAccess="yes" />
  <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah.Sql" />
</elmah>

非常感谢你的帮助。

1 个答案:

答案 0 :(得分:0)

Marc感谢编辑,

我遇到问题我需要添加

<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="Individual,Owner" />