-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Razor Pages route value in MiniProfiler name (#495)
If you are using Razor Pages instead of controllers and views MiniProfiler shows all result names in the results list as `/`. This is because `routeData.Values["controller"]` and `routeData.Values["action"]` are null. This change checks if `routeData.Values["pages"]` has a value and uses that for the MiniProfiler name if available. I've also added a Razor Page to the Asp.Net Core 3 sample for testing
- Loading branch information
Showing
6 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@page | ||
|
||
@{ | ||
ViewData["Title"] = "Razor Pages Sample"; | ||
} | ||
<div class="col-md-12"> | ||
<div class="page-header"> | ||
<h2>ASP.NET Core 3: Behold MiniProfiler in the top right (Razor Pages Version)!</h2> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<partial name="Index.LeftPanel" /> | ||
<partial name="Index.RightPanel" /> | ||
</div> | ||
@section scripts { | ||
<script> | ||
$(function () { | ||
// these links should fire ajax requests, not do navigation | ||
$('.ajax-requests a').click(function () { | ||
var $clicked = $(this), | ||
$spinner = $('<span class="glyphicon glyphicon-refresh spinning" title="Working..."></span>').appendTo($clicked.parent()), | ||
$results = $('.ajax-results'); | ||
$.ajax({ | ||
type: 'GET', | ||
url: this.href, | ||
success: function (data) { | ||
$('<p class="ajax-result">').append(data).appendTo($results); | ||
}, | ||
error: function () { $results.append('<p>ERROR!</p>'); }, | ||
complete: function () { $spinner.remove(); } | ||
}); | ||
return false; | ||
}); | ||
}); | ||
</script> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@using Samples.AspNetCore | ||
@namespace Samples.AspNetCore.Pages | ||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@{ | ||
Layout = "_Layout"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters