Skip to content

Commit 50a38c6

Browse files
authored
Update IdentityRedirectManager for .NET 10 breaking change
Address .NET 10 breaking change in NavigationManager behavior: dotnet/aspnetcore#61811
1 parent a1af887 commit 50a38c6

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/dotnet-scaffolding/dotnet-scaffold-aspnet/Templates/BlazorIdentity/IdentityRedirectManager.tt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ namespace <#= Model.BlazorIdentityNamespace #>
1818
MaxAge = TimeSpan.FromSeconds(5),
1919
};
2020

21-
[DoesNotReturn]
2221
public void RedirectTo(string? uri)
2322
{
2423
uri ??= "";
@@ -32,18 +31,15 @@ namespace <#= Model.BlazorIdentityNamespace #>
3231
// During static rendering, NavigateTo throws a NavigationException which is handled by the framework as a redirect.
3332
// So as long as this is called from a statically rendered Identity component, the InvalidOperationException is never thrown.
3433
navigationManager.NavigateTo(uri);
35-
throw new InvalidOperationException($"{nameof(IdentityRedirectManager)} can only be used during static rendering.");
3634
}
3735

38-
[DoesNotReturn]
3936
public void RedirectTo(string uri, Dictionary<string, object?> queryParameters)
4037
{
4138
var uriWithoutQuery = navigationManager.ToAbsoluteUri(uri).GetLeftPart(UriPartial.Path);
4239
var newUri = navigationManager.GetUriWithQueryParameters(uriWithoutQuery, queryParameters);
4340
RedirectTo(newUri);
4441
}
4542

46-
[DoesNotReturn]
4743
public void RedirectToWithStatus(string uri, string message, HttpContext context)
4844
{
4945
context.Response.Cookies.Append(StatusCookieName, message, StatusCookieBuilder.Build(context));
@@ -52,10 +48,8 @@ namespace <#= Model.BlazorIdentityNamespace #>
5248

5349
private string CurrentPath => navigationManager.ToAbsoluteUri(navigationManager.Uri).GetLeftPart(UriPartial.Path);
5450

55-
[DoesNotReturn]
5651
public void RedirectToCurrentPage() => RedirectTo(CurrentPath);
5752

58-
[DoesNotReturn]
5953
public void RedirectToCurrentPageWithStatus(string message, HttpContext context)
6054
=> RedirectToWithStatus(CurrentPath, message, context);
6155
}

0 commit comments

Comments
 (0)