dotnet / dotnet/aspnetcore

UseStatusCodePagesWithRedirects not working

Open
#53,210 2 comments 0 reactions 0 assignees View on GitHub
area-middleware
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

I added this code to my program.cs but its not getting triggered, i already have my Error page

app.UseStatusCodePagesWithRedirects("/Error?code={0}");

### Expected Behavior

When my token is expired the UseStatusCodePagesWithRedirects should automatically detect a 401 error returned by my api call and will automatically redirect to the Error page

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

.NET 8

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.