0

I am using windows authentication, and I would like to get the name from the request in the form of domain\name. Currently I am using this: var name = HttpContext.Current.User.Identity.Name;, which has worked in the prior tests, but now I have CORS errors.

In IIS I have Windows Authentication enabled, and others disabled (anonymous authentication), but when I visit the website, I get CORS errors, saying the origins are not set. I then tried setting the headers in HTTP Response Headers in IIS, setting the allow origins to http://localhost:4200, allow credentials to true, and allowing all headers and methods, but then i get errors saying, that origins is set twice http://localhost:4200, http://localhost:4200, I also tried turning on anonymous authentication, but then the before mentioned var name = HttpContext.Current.User.Identity.Name; is an empty string.

This is how my cors setup looks like:

var cors = new EnableCorsAttribute("http://localhost:4200", "*", "*")
{
    SupportsCredentials = true,
};

And this is my web.config

...
<system.web>
    <authentication mode="Windows" />
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
</system.web>
...
qlabfgerkaSmurf
  • 347
  • 1
  • 5
  • 20

0 Answers0