Skip to content

Commit 8a4b839

Browse files
authored
Fixes in DownloadPersonalData (#14203)
* Fixes in DownloadPersonalData * use SerializeToUTf8 instead * Remove reference to newtonsoft
1 parent b960e07 commit 8a4b839

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

src/Identity/UI/ref/Microsoft.AspNetCore.Identity.UI.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
</PropertyGroup>
66
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'">
77
<Compile Include="Microsoft.AspNetCore.Identity.UI.netcoreapp.cs" />
8-
<Reference Include="Newtonsoft.Json" />
98
<Reference Include="Microsoft.AspNetCore.Identity" />
109
<Reference Include="Microsoft.AspNetCore.Mvc" />
1110
<Reference Include="Microsoft.AspNetCore.StaticFiles" />

src/Identity/UI/src/Areas/Identity/Pages/V3/Account/Manage/DownloadPersonalData.cshtml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
using System.Collections.Generic;
66
using System.Linq;
77
using System.Text;
8+
using System.Text.Json;
89
using System.Threading.Tasks;
910
using Microsoft.AspNetCore.Mvc;
1011
using Microsoft.AspNetCore.Mvc.RazorPages;
1112
using Microsoft.Extensions.Logging;
12-
using Newtonsoft.Json;
1313

1414
namespace Microsoft.AspNetCore.Identity.UI.V3.Pages.Account.Manage.Internal
1515
{
@@ -79,7 +79,7 @@ public override async Task<IActionResult> OnPostAsync()
7979
personalData.Add($"Authenticator Key", await _userManager.GetAuthenticatorKeyAsync(user));
8080

8181
Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json");
82-
return new FileContentResult(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(personalData)), "text/json");
82+
return new FileContentResult(JsonSerializer.SerializeToUtf8Bytes(personalData), "application/json");
8383
}
8484
}
8585
}

src/Identity/UI/src/Areas/Identity/Pages/V4/Account/Manage/DownloadPersonalData.cshtml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
using System.Collections.Generic;
66
using System.Linq;
77
using System.Text;
8+
using System.Text.Json;
89
using System.Threading.Tasks;
910
using Microsoft.AspNetCore.Mvc;
1011
using Microsoft.AspNetCore.Mvc.RazorPages;
1112
using Microsoft.Extensions.Logging;
12-
using Newtonsoft.Json;
1313

1414
namespace Microsoft.AspNetCore.Identity.UI.V4.Pages.Account.Manage.Internal
1515
{
@@ -79,7 +79,7 @@ public override async Task<IActionResult> OnPostAsync()
7979
personalData.Add($"Authenticator Key", await _userManager.GetAuthenticatorKeyAsync(user));
8080

8181
Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json");
82-
return new FileContentResult(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(personalData)), "text/json");
82+
return new FileContentResult(JsonSerializer.SerializeToUtf8Bytes(personalData), "application/json");
8383
}
8484
}
8585
}

src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
</ItemGroup>
3737

3838
<ItemGroup>
39-
<Reference Include="Newtonsoft.Json" />
4039
<Reference Include="Microsoft.AspNetCore.Identity" />
4140
<Reference Include="Microsoft.AspNetCore.Mvc" />
4241
<Reference Include="Microsoft.AspNetCore.StaticFiles" />

0 commit comments

Comments
 (0)