Closed as not planned
Description
openedon Feb 2, 2022
If I have an asp.net core razor page, with no controller, how do I hook the dependency injection as suggested in
#1152
and
https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core#how-can-i-track-telemetry-thats-not-automatically-collected
The code as follows runs but the events are never written when I use the dependency injections methods for .net core. Other regular app insights events process fine.
namespace simplewebapp.Pages
{
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private TelemetryClient telemetry;
public IndexModel(ILogger<IndexModel> logger, TelemetryClient telemetry)
{
_logger = logger;
this.telemetry = telemetry;
telemetry.TrackEvent("IndexPage_IndexModel");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment