Missing X-MiniProfiler-Ids from headers in ajax requests


I am using a combination of mvc views and Microsoft WebApi in my application and have installed miniprofiler.

The miniprofiler works great for normal requests for MVC views but it does not refresh when I do ajax requests against webapi methods. However they show up if I refresh the page.

The ajax requests are done using jQuery 1.7.1 and calls ApiController methods in the same application.

The problem seems to be that the json response does not contain the X-MiniProfiler-Ids header.

Am I missing some configuration settings or is this an issue with miniprofiler?

If you could provide a sample for me I would really appreciate it.

Here is the code I am using:


  Shared Sub RegisterGlobalFilters(ByVal filters As GlobalFilterCollection)
        filters.Add(New ProfilingActionFilter())
    End Sub

 Sub Application_Start()

        Dim copy = ViewEngines.Engines.ToList()

        For Each item In copy
            ViewEngines.Engines.Add(New ProfilingViewEngine(item))
    End Sub

Sub Application_BeginRequest()
End Sub

Sub Application_EndRequest()
End Sub


<ProfilingActionFilter()> _
        Public Function GetChallenges() As IEnumerable(Of ChallengeListItem)
            Using StackExchange.Profiling.MiniProfiler.StepStatic("GetChallenges", StackExchange.Profiling.ProfileLevel.Info)
                Dim vAuthToken As Guid
                Guid.TryParse(HttpContext.Current.Request.Headers.GetValues(AUTHORIZATIONTOKENKEY).FirstOrDefault(), vAuthToken)

                Dim vChallenges As List(Of ChallengeListItem)
                vChallenges = ChallengeData.GetChallenges(vAuthToken)
                Return vChallenges
            End Using
        End Function



javascript request:

this.getChallenges = function (callback) {
                type: 'GET',
                url: 'api/Challenges/',
                beforeSend: function (xhr) {
                    xhr.setRequestHeader("Authorization-Token", userToken);
                success: function (data) {
                    if (callback)
                error: function (error) {
                    if (error.status == 401) { 
                    } else {


can you debug through it and see that MiniProfiler.Start and MiniProfiler.Stop are being called properly, could there be a filter that is stripping response headers?


I’m having a similar issue. The profiler renders the MVC results but fails to display the API results. In my case, requests to the API are cross-origin, so I’m thinking the header is getting lost after the preflighted request. I’ve tried adding a Access-Control-Expose-Headers header with a value of “X-MiniProfiler-Ids”, but the header is still missing on my API response.