Почему <отклоняют пользователей =“?”/> включенный в следующий пример?

Хорошо, во-первых, вы не можете иметь повторяющиеся идентификаторы, так как идентификаторы используются для уникальных элементов. Чтобы исправить ваш код, вы должны сделать что-то вроде этого:

<span>ignored</span>
<div class="specialid"><!--odd - select-->
  <span>ignore</span>
  <span class="specialchild">not ignored</span><!--do not ignore b/c odd parent of #specialid-->
  <div class="specialid"><!--even - do not select-->
    <div>
      <div>
        <span class="specialchild">ignored</span><!--ignore-->
      </div>
    </div>
    <div class="specialid"><!--odd - select-->
      <span class="specialchild">not ignored</span><!--do not ignore b/c odd parent of #specialid-->
      <span>ignored</span><!--ignore-->
    </div>
  </div>
  <div><!--not #specialid, so ignore in even-odd toggle-->
    <div class="specialid"><!--even - select-->
      <span class="specialchild">ignored</span><!--ignore b/c even parent of #specialid-->
    </div>
  </div>
</div>

Честно говоря, я не совсем уверен, что вы пытаетесь достичь с помощью этого кода, и структура немного странная , но я, вероятно, рекомендую использовать такие определения:

  1. Для ссылки на нечетные .specialid элементы.

    .specialid:nth-child(odd) { ... }

  2. Для обозначения нечетного .specialchild дочернего элемента нечетного .specialid

    .specialid:nth-child(odd) > .specialchild:nth-child(even) { ... }

  3. Чтобы ссылаться на нечетные .specialid элементы внутри нечетных .specialid элементов

    .specialid:nth-child(odd) .specialid:nth-child(even) { ... }

Я не уверен, чего еще вы пытаетесь достичь но сначала вы должны поработать над своей HTML-структурой.

71
задан SteveC 29 August 2014 в 08:42
поделиться

3 ответа

ASP.NET grants access from the configuration file as a matter of precedence. In case of a potential conflict, the first occurring grant takes precedence. So,

deny user="?" 

denies access to the anonymous user. Then

allow users="dan,matthew" 

grants access to that user. Finally, it denies access to everyone. This shakes out as everyone except dan,matthew is denied access.

Edited to add: and as @Deviant points out, denying access to unauthenticated is pointless, since the last entry includes unauthenticated as well. A good blog entry discussing this topic can be found at: Guru Sarkar's Blog

85
ответ дан 24 November 2019 в 13:02
поделиться

"At run time, the authorization module iterates through the allow and deny elements, starting at the most local configuration file, until the authorization module finds the first access rule that fits a particular user account. Then, the authorization module grants or denies access to a URL resource depending on whether the first access rule found is an allow or a deny rule. The default authorization rule is . Thus, by default, access is allowed unless configured otherwise."

Article at MSDN

deny = * means deny everyone
deny = ? means deny unauthenticated users

In your 1st example deny * will not affect dan, matthew since they were already allowed by the preceding rule.

According to the docs, here is no difference in your 2 rule sets.

38
ответ дан 24 November 2019 в 13:02
поделиться

Пример 1 для приложений asp.net, использующих аутентификацию форм. Это обычная практика для интернет-приложений, потому что пользователь не проходит проверку подлинности до тех пор, пока не пройдет проверку подлинности на каком-либо модуле безопасности.

Пример 2 для приложения asp.net, использующего аутентификацию Windows. Аутентификация Windows использует Active Directory для аутентификации пользователей. Будет препятствовать доступу к вашему приложению. Я использую эту функцию в интранет-приложениях.

4
ответ дан 24 November 2019 в 13:02
поделиться
Другие вопросы по тегам:

Похожие вопросы: