.net core 7 mvc web app hosted on IIS 10 inprocess - when using GetServerVariable always null

Jeremy Burkhart 0 Reputation points
2023-03-21T15:47:41.83+00:00

Converted a .net 4.7.1 mvc web app to .net core 7, hosted on iis 10 , in process. A single sign on service sets a server variable that I need to access. When I use HttpContext.GetServerVariable, the value is always null.

I have confirmed using an aspx page under .net 4.7.1 framework on the server that the server variable is being set and accessible to IIS, it just does not work when using .net core 7.

thanks

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,156 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,601 Reputation points
    2023-03-21T21:18:43.43+00:00

    if the GetServerVariable feature is enabled,

    ctx.Features.Get<IServerVariablesFeature>()

    then most likely your 3rd party handler is not setting the value before asp.net core reads it. check module order, and events

    0 comments No comments