Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SecurityStrategy.AnonymousAllowedTypes Property

Specifies types that users can access anonymously before they log in.

Namespace: DevExpress.ExpressApp.Security

Assembly: DevExpress.ExpressApp.Security.v24.2.dll

#Declaration

[Browsable(false)]
public IList<Type> AnonymousAllowedTypes { get; }

#Property Value

Type Description
IList<Type>

A list of types that users can access anonymously.

#Remarks

Anonymous access may be required when you use custom logon parameters and want to display certain data in the logon window before a user logs on. Add the required types to the AnonymousAllowedTypes collection to grant access to these types before a successful user authentication. This code should be executed before the application displays the logon window.

The following examples demonstrate how to specify this property:

#WinForms

  • In applications created in v22.1+:

    File: MySolution.Win\Startup.cs

    // ...
    public class ApplicationBuilder : IDesignTimeApplicationFactory {
        public static WinApplication BuildApplication(string connectionString) {
            // ...
            builder.Security
                .UseIntegratedMode(options => {
                    // ...
                    options.Events.OnSecurityStrategyCreated = securityStrategyBase => {
                        // ...
                        var securityStrategy = (SecurityStrategy)securityStrategyBase;
                        securityStrategy.AnonymousAllowedTypes.Add(typeof(Company));
                        securityStrategy.AnonymousAllowedTypes.Add(typeof(ApplicationUser));
                    };
                })
            // ...
        }
    }
    
  • In applications that do not use application builders:

    File: MySolution.Win\WinApplication.cs(.vb) (the WinApplication descendant’s constructor).

    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.Security;
    using DevExpress.ExpressApp.Win;
    // ...
    public partial class CustomLogonParametersExampleWindowsFormsApplication : WinApplication {
        // ...
        public CustomLogonParametersExampleWindowsFormsApplication() {
            // ...
            ((SecurityStrategy)Security).AnonymousAllowedTypes.Add(typeof(Company));
            ((SecurityStrategy)Security).AnonymousAllowedTypes.Add(typeof(ApplicationUser));
        }
        // ...
    }
    

#ASP.NET Web Forms

File: MySolution.Web\WebApplication.cs(.vb) (the WebApplication descendant’s constructor).

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Security;
using DevExpress.ExpressApp.Web;
// ...
public partial class CustomLogonParametersExampleAspNetApplication : WebApplication {
    // ...
    public CustomLogonParametersExampleAspNetApplication() {
        // ...
        ((SecurityStrategy)Security).AnonymousAllowedTypes.Add(typeof(Company));
        ((SecurityStrategy)Security).AnonymousAllowedTypes.Add(typeof(ApplicationUser));
    }
    // ...
}
See Also