ActiveReports 12 Server User Guide
Debug a Custom Security Provider
ActiveReports 12 Server User Guide > How To > Debug a Custom Security Provider

Once you have created a custom security provider, you may need to debug it. The following steps walk you through how to do this using the sample custom security provider project installed with ActiveReports Server. By default, this sample is in the following folder.

C:\ActiveReports 12 Server\SDK\Samples\ActiveTunes.SecurityProvider

To deploy the custom security provider for debugging

  1. If you have not done so already, open the project in Visual Studio and from the Build menu, select Build Solution.
  2. If you have not done so already, in the C:\ActiveReports 12 Server directory, create a new folder named SecurityProviders.
  3. From your project bin\Debug\ folder, copy the following files, and paste them into C:\ActiveReports 12 Server\SecurityProviders\ to make the security provider and debugging file available to ActiveReports 12 Server. 
    • ActiveTunes.SecurityProvider.dll
    • ActiveTunes.SecurityProvider.pdb
    • System.Data.SQLite.dll
  4. Open the ActiveReports Administrator Dashboard in your browser, and under Configuration, select Security Provider.
  5. Next to Custom security provider, drop down the list and select ActiveTunesSecurityProviderFactory. The page refreshes to allow you specify security provider settings and to test the configured provider. 
    Important: If you need to update the DLL at any point, you must first change this value back to Default (builtin). You can change it back after you finish updating the DLL.
  6. Under Security Provider Settings, for the ConnectionString property, enter the following connection string and click Apply changes
    Connection string
    Copy Code
    Data Source=C:\ActiveReports 12 Server\SDK\Samples\ActiveTunes.SecurityProvider\ActiveTunes.sqlite 
    

To debug the custom security provider

In order to perform the following steps, you must run Visual Studio as Administrator.

  1. From the Visual Studio Tools menu, select Attach to Process.
  2. In the Attach to Process dialog that appears, select the Show processes in all sessions checkbox, or navigate to the remote machine where the server web site resides. 
  3. Scroll down and select the w3wp.exe process for server's web site and click Attach. The project goes into Debugging mode.
    Caution: There may be multiple w3wp.exe processes, so be sure to attach the one on the server machine running the ActiveReports services.
  4. In the ActiveTunesSecurityProvider.cs file, locate the ActiveTunesSecurityProvider.CreateToken method and click in the margin to the left to set a breakpoint on it.
  5. In your browser, on the Administrator Dashboard Security Provider page in the Login to test and Password to test boxes, enter test values from the table below.
    Login Password
    andrew@chinookcorp.com 1
    nancy@chinookcorp.com 2
    jane@chinookcorp.com 3
    margaret@chinookcorp.com 4
    steve@chinookcorp.com 5
    michael@chinookcorp.com 6
    robert@chinookcorp.com 7
    laura@chinookcorp.com 8
  6. Click the Test provider link. The Visual Studio window takes focus and shows the breakpoint, allowing you to debug the code.

To debug your custom security provider with Visual Studio on the server

Here is another way to debug your security provider if you have Visual Studio installed on the server and have direct access to the server machine.

Caution: Ensure that you remove this code before you go live with your deployment.

  1. Open your SecurityProvider implementation, and in one of its methods,  for example, ISecurityProviderFactory.Create, add the following code.
    C# code. Paste inside the method to debug.
    Copy Code
    System.Diagnostics.Debugger.Break();
    
  2. From the Build menu, select Rebuild Solution.
  3. Copy the resulting DLL and PDB files and paste them into C:\ActiveReports 12 Server\SecurityProviders\.
  4. Open the ActiveReports Administrator Dashboard in your browser, and under Configuration, select Security Provider.
  5. Next to Custom security provider, drop down the list and select your security provider. The page refreshes to allow you specify any security provider settings specified in your provider. 
    Important: If you need to update the DLL at any point, you must first change this value back to Default (builtin). You can change it back after you finish updating the DLL.
  6. When you run a test or try to log in as a user, The Visual Studio Just-In-Time Debugger prompt appears asking whether you want to debug w3wp.exe.
  7. Click Yes to open Visual Studio and begin debugging.
See Also