Click here to Skip to main content
14,699,608 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a controller that reads the user's info from HTTP header. The header contains user info that returns from a single sign on (SiteMinder).

Here is the code that I try:
[HttpGet]
public async Task<IEnumerable<UserForDisplayDto>> GetAllUsers()
{
    var person = Request.Headers["HTTP_JHED_UID"];
    if (await context.Users.AnyAsync(x => x.JHED_ID == person))
    {
        var users = await repository.GetAllUsers();
        return mapper.Map<IEnumerable<User>, IEnumerable<UserForDisplayDto>>(users);
    }
    else
    {
        return null;
    }


}


"HTTP_JHED_UID" is the header and on my local db, I have JHED_ID column in Users table. Basically, I am trying to compare the incoming JHED ID to local JHED ID. If it's in there, get the users, otherwise return null.

What I have is 500 server error. I can't get this working. Any help will be appreciated!

What I have tried:

I use
Request.Headers["HTTP_JHED_UID"]

Response.Headers["HTTP_JHED_UID"]
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900