Skip to content

Commit

Permalink
Do not read claims from SqlRoleProvider under classic ASP.NET (#2377)
Browse files Browse the repository at this point in the history
* Do not read claims from SqlMembershipProvider under classic ASP.NET

* check for role providers only
  • Loading branch information
Mpdreamz authored Jun 17, 2024
1 parent fccf2df commit 3cbf599
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<ProjectReference Include="..\..\Elastic.Apm\Elastic.Apm.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ private void FillSampledTransactionContextUser(HttpContext context, ITransaction
return;

var user = new User { UserName = userIdentity.Name };

if (context.User is ClaimsPrincipal claimsPrincipal)
var sqlRoleProvider = 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 3cbf599

Please sign in to comment.