Question: I am trying to configure **elmah** with **sql server**.
The **configuration** I see are of this form

```
public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        ...
    }
    private static void InjectsAuthElements(IServiceCollection services)
    {
        ...
        services.AddElmah<SqlErrorLog>(options =>
        {
            options.Path = "ElmahNewNameForSecurity.axd";
            options.OnPermissionCheck = context => context.User.Identity.IsAuthenticated && context.User.IsInRole("Admin");
            options.ConnectionString = "MyConnectionString";
        });
    }
}

```

I want to replace **MyConnectionString** by something like `Configuration.GetConnectionString("Default")`.

Answer: 
I have addressed this problem by generating [URL Access urls](https://learn.microsoft.com/en-us/sql/reporting-services/url-access-ssrs?view=sql-server-ver15#url-access-syntax) and linking to them. You can also put them in iframes.

```
const makeReportLink = (reportPath, reportParams = {}, zoom = 100) => {
    const reportViewerUrl = 'http://report-server-host/ReportServer_SSRS/Pages/ReportViewer.aspx';
    const reportParamDefaults = {
        'rs:Command': 'Render',
        'rc:Parameters' : 'false',
        'rc:Zoom': zoom,
    };

    let reportSP = new URLSearchParams({...reportParamDefaults, ...reportParams});

    return `${reportViewerUrl}?${reportPath}&${reportSP.toString()}`;
}

```
I have done following to achieve this

1. Created One POST API, it saves dictionary of Report params in txt file with Unique GUID.
2. Sent Iframe request like http://servername/reportviewer.aspx?reportid= from React app to .Net Application Report Viewer aspx page (Microsoft.ReportViewer.WebForms) with unique GUID, that page gets all params from txt file , sets Authentication , Get Repprt Data from SSRS and show Report Data.
3. Since SSRS opens in IFrame, on refresh it will look for session, which will not be found in React App, for that below web.config additon is required in .net application:

```
 <sessionState cookieless="true" mode="InProc" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" stateConnectionString="tcpip=127.0.0.1:42424" timeout="8000"/>

```

cookieless="**true**" is important other wise you will get "asp.net session has expired or could not be found" Error.