Click or drag to resize

Register and configure component on startup application

In your web application startup you must register and configure ASDSoft.WebSigner component.

.NET Framework ASP.NET WebForms or MVC host application

Main two steps for initialization of the component

  1. Configure component

    For configuration component you can create instance of StartupSettings and set a properties.

  2. Register component

    For registration component you can call static method InitializeStatic(StartupSettings) with configuration parameter.

Example
Configure and register component in Global.asax. MySigner is host application implementation of SignerBase, see Implement SignerBase abstract class.
C#
protected void Application_Start(object sender, EventArgs e)
{
  WebSigner.Server.AspNet.Startup.InitializeStatic(
  new WebSigner.Server.AspNet.StartupSettings("[My app friendly name]", new MySigner())
  {
    CachePersistor = null,
    CertificateAuthenticationProvider = null,
    AuthenticationPersistor = null,
    GlobalConfigurationCallback = null,
    HelpCssUrl = null,
    LogoBitmap = null
  });
}
ASP.NET Core host application
Example
Register and configure component in standard .NET Core Startup.
C#
public void ConfigureServices(IServiceCollection services)
{
  services
    .AddMvc()
    .AddAsdWebSigner<MySigner>();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    app.UseStaticFiles();
    app.UseRouting();

    app.UseAsdWebSigner(new StartupSettings("[My app friendly name]", null)
    {
        CachePersistor = null,
        CertificateAuthenticationProvider = null, 
        AuthenticationPersistor = null,
        HelpCssUrl = null
    });

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapControllers();
    });
}
See Also