IvanJosipovic / BlazorApplicationInsights

Application Insights for Blazor web applications
https://BlazorApplicationInsights.netlify.app
MIT License
189 stars 26 forks source link

ConnectionString from server to client with v3.0.0 #246

Closed vedion closed 11 months ago

vedion commented 11 months ago

Hi,

Before v3.0.0 the connection string could with a cookie on the blazor WASM server be transfered to the client:

app.MapFallbackToFile("index.html", new StaticFileOptions()
{
    OnPrepareResponse = ctx =>
    {
        ctx.Context.Response.Cookies.Append("ai_connString", app.Configuration["ApplicationInsights:ConnectionString"]);
    }
});

With v3.0.0 it now it looks like the client needs both the ConnectionString and InstrumentationKey:

builder.Services.AddBlazorApplicationInsights(config =>
{
    config.ConnectionString = "{Insert Connection String}";
    config.InstrumentationKey = "{Insert Instrumentation Key}";
});

https://github.com/IvanJosipovic/BlazorApplicationInsights#install-on-blazor-webassembly-standalone-app

How do we now get these settings from the server to the client?

Best Regards, Anders Havn

IvanJosipovic commented 11 months ago

"With v3.0.0 it now it looks like the client needs both the ConnectionString and InstrumentationKey:"

Both are only needed if you want to set the connection string programmatically, through the new method. The old approach should work as expected.