Skip to content

Blazor Error Headers are read-only, response has already started #62115

Closed
@KhaledHani02

Description

@KhaledHani02

Hi I'm trying to implement Log in method with Identity

public async Task<bool> LoginAsync(LogInHMI loginModel)
{
    try
    {
        var user = await _userManager.FindByNameAsync(loginModel.UserName);
        if (user == null)
            return false;

        var result = await _signInManager.PasswordSignInAsync(user.UserName, loginModel.Password, isPersistent: false, lockoutOnFailure: false);
        return result.Succeeded;
    }
    catch (Exception ex)
    {
        throw new Exception(ex.Message);
    }
}

and i'm getting this error:
System.InvalidOperationException: 'Headers are read-only, response has already started.'

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsThis issue tracks updating documentationarea-identityIncludes: Identity and providers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions