Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Create a bootleg IPrincipal and then you have to use that. If the bootleg principal has access then anonymous access is allowed.</p> <pre><code>public static class AnonymousAccessCheck { public static bool IsAnonymousAccessAllowed(HttpRequest request) { // unfortunately checking if a page allows anonymous access is more complicated than you'd think(I think). // here we have to create a "Fake" IPrincipal that will only ever have access to // pages that allow anonymous access. That way if our fake principal has access, // then anonymous access is allowed UrlAuthorizationModule urlAuthorizationModule = new UrlAuthorizationModule(); return UrlAuthorizationModule.CheckUrlAccessForPrincipal(request.Path, AnonymousPrincipal.Instance, request.RequestType); } private class AnonymousPrincipal : IPrincipal { private static AnonymousPrincipal _Instance; public static AnonymousPrincipal Instance { get { if (_Instance == null) _Instance = new AnonymousPrincipal(); return _Instance; } } private AnonymousPrincipal() { _Identity = new AnonymousIdentity(); } private readonly IIdentity _Identity; #region IPrincipal Members public IIdentity Identity { get { return _Identity; } } public bool IsInRole(string role) { return false; } #endregion private class AnonymousIdentity : IIdentity { #region IIdentity Members public string AuthenticationType { get { return string.Empty; } } public bool IsAuthenticated { get { return false; } } public string Name { get { return string.Empty; } } #endregion } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload