I would like to log the "Event URL" field in Kentico Portal logs to Azure Application Insights for 404 requests. Since I changed my custom page for 404 errors in Kentico Portal I only get "PortalTemplate.apsx" for the url field in the requests table in AppInsights.
Asked
Active
Viewed 149 times
1 Answers
1
We already have this as a recommendation on the GitHub - use RawUrl
instead of Request.Url
.
As explained here RawUrl better suites cases when the request was redirected to the custom error page: Request.RawUrl vs. Request.Url
Please upvote the issue on GitHub. As a workaround now you can replace OperationNameTelemetryInitializer in ApplicaitonInsights.config
to your own implementation of it that uses RawUrl
instead of the Url
.

Community
- 1
- 1

Sergey Kanzhelev
- 333
- 1
- 3
-
Do you know what I should change in OperationNameTelemetryInitializer? – purplePanda Oct 31 '16 at 20:53
-
@purplePanda in the [line](https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/75373e57dcf8d646c54ee188461c373f2cc98939/Src/Web/Web.Shared.Net/Implementation/RequestTrackingExtensions.cs#L49) `string name = request.UnvalidatedGetPath();` use the path from `RawUrl`. Also set the `RequestTelemetry.Url` to `RawUrl` value in `OperationNameTelemetryInitializer` itself or create a new initializer for it. – Sergey Kanzhelev Dec 07 '16 at 06:25