Assert User.Identity.Name is set right in my MVC app
I have an ASP.NET MVC application running on IIS 7.5 with an application pool set to "roger01".
I would like to make sure that the @User.Idenity.Name
identity (roger01) is displayed when displayed .
I tried to use ASP impersonation but is not compatible with Integrated Mode. ASP.NET MVC requires integrated mode.
I also set the anonymous authentication id to "roger01", but didn't change anything.
I've actually tried a lot of things over the course of hours, I can't even list ...
source to share
This answer looks like it can accomplish what you need.
IIS Application Pool ID
When creating a new application pool, it is often convenient to identify the identity that the pool is using. The problem usually occurs on IIS 7 / 7.5 where application pools use the IIS form identifiers AppPool \ identityname by default . And when you provide access to databases / file you need to provide the username exactly.
I usually use this simple script. Just copy it into a text file, name it test.aspx and point your browser to it. the application pools id name will be presented to you in the path.
<%@ Page Language="C#" %> Current user: <%= System.Security.Principal.WindowsIdentity.GetCurrent().Name %>
source to share