Skip to content

Commit

Permalink
Fix #2415 lookup for SqlRoleProvider breaks in ASP.NET identity 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Aug 14, 2024
1 parent 2d1a0db commit e1819a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ endif::[]
[[release-notes-1.x]]
=== .NET Agent version 1.x
[[release-notes-1.28.2]]
==== 1.28.2 - 2024/08/14
===== Bug fixes
{pull}2415[#2415] Fixed check for SqlRoleProvider under AspNet Identity 2.
[[release-notes-1.28.1]]
==== 1.28.1 - 2024/08/12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,9 @@ private void FillSampledTransactionContextUser(HttpContext context, ITransaction
return;

var user = new User { UserName = userIdentity.Name };
var sqlRoleProvider = System.Web.Security.Roles.Providers.Cast<object>().Any(provider => provider.GetType().Name == "SqlRoleProvider");

var sqlRoleProvider =
System.Web.Security.Roles.Enabled && System.Web.Security.Roles.Providers.Cast<object>().Any(provider => provider.GetType().Name == "SqlRoleProvider");
if (!sqlRoleProvider && context.User is ClaimsPrincipal claimsPrincipal)
{
try
Expand Down

0 comments on commit e1819a8

Please sign in to comment.