how to make authorization for login
I tried to make beginner login page with authorization but Im getting this error message
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
Unhandled exception rendering component: OnStarting cannot be set because the response has already started.
System.InvalidOperationException: OnStarting cannot be set because the response has already started.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowResponseAlreadyStartedException(String value)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.OnStarting(Func`2 callback, Object state)
at CustomAuthenticationStateProvider.MarkUserAsAuthenticated(String username, String role) in /Users/ensarerdeve/Documents/VSC Projects/testtrack/ProtaTestTrack2/Services/CustomAuthenticationProvider.cs:line 34
at ProtaTestTrack2.Components.Pages.Login.LoginUser() in /Users/ensarerdeve/Documents/VSC Projects/testtrack/ProtaTestTrack2/Components/Pages/Login.razor:line 40
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at MudBlazor.MudBaseButton.OnClickHandler(MouseEventArgs ev)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle,
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
Unhandled exception rendering component: OnStarting cannot be set because the response has already started.
System.InvalidOperationException: OnStarting cannot be set because the response has already started.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowResponseAlreadyStartedException(String value)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.OnStarting(Func`2 callback, Object state)
at CustomAuthenticationStateProvider.MarkUserAsAuthenticated(String username, String role) in /Users/ensarerdeve/Documents/VSC Projects/testtrack/ProtaTestTrack2/Services/CustomAuthenticationProvider.cs:line 34
at ProtaTestTrack2.Components.Pages.Login.LoginUser() in /Users/ensarerdeve/Documents/VSC Projects/testtrack/ProtaTestTrack2/Components/Pages/Login.razor:line 40
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at MudBlazor.MudBaseButton.OnClickHandler(MouseEventArgs ev)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle,
2 Replies
ComponentState owningComponentState)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit 'MRaI1ABm-rp1KLVaCe5MPkhKsLRrO5zCAz5FZHLIDjk'.
System.InvalidOperationException: OnStarting cannot be set because the response has already started.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowResponseAlreadyStartedException(String value)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.OnStarting(Func`2 callback, Object state)
at CustomAuthenticationStateProvider.MarkUserAsAuthenticated(String username, String role) in /Users/ensarerdeve/Documents/VSC Projects/testtrack/ProtaTestTrack2/Services/CustomAuthenticationProvider.cs:line 34
at ProtaTestTrack2.Components.Pages.Login.LoginUser() in /Users/ensarerdeve/Documents/VSC Projects/testtrack/ProtaTestTrack2/Components/Pages/Login.razor:line 40
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at MudBlazor.MudBaseButton.OnClickHandler(MouseEventArgs ev)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
ComponentState owningComponentState)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit 'MRaI1ABm-rp1KLVaCe5MPkhKsLRrO5zCAz5FZHLIDjk'.
System.InvalidOperationException: OnStarting cannot be set because the response has already started.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowResponseAlreadyStartedException(String value)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.OnStarting(Func`2 callback, Object state)
at CustomAuthenticationStateProvider.MarkUserAsAuthenticated(String username, String role) in /Users/ensarerdeve/Documents/VSC Projects/testtrack/ProtaTestTrack2/Services/CustomAuthenticationProvider.cs:line 34
at ProtaTestTrack2.Components.Pages.Login.LoginUser() in /Users/ensarerdeve/Documents/VSC Projects/testtrack/ProtaTestTrack2/Components/Pages/Login.razor:line 40
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at MudBlazor.MudBaseButton.OnClickHandler(MouseEventArgs ev)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
https://paste.mod.gg/upnwgeqptjot/0 here are my whole related codes with auth
BlazeBin - upnwgeqptjot
A tool for sharing your source code with the world!