Question

I'm confused about how to set windows auth. in asp.net 4.5 should I do it from IIS only without setting any configuration in web.config or should I do it from web.config without setting anything in IIS

I am using asp.net forms 4.5 on windows 8.1 and IIS 8.5.

sub-issue: when I set it from iis it works fine by disabling anonymous auth. and enabling windows auth. but when I try to do it a lone from web.config it won't work. I do it like that

<authentication mode="Windows" />
<authorization>      
    <deny users="?" />
</authorization>

and I leave the default configuration in IIS what is happing is I keep getting Access is denied I was expecting to have my local account logged-In but i just got access is denied

I am not in a domain

Was it helpful?

Solution 2

I misunderstood the nature of the relationship between IIS and ASP.NET

I read about it and I found it should be set from both and it depends on what authentication I am going to use

for example If I am using windows authentication I have to set it first from IIS and after that from web.config, simply because IIS will authenticate the request first and pass authentication token to asp.net authentication module which should be set in the web.config

OTHER TIPS

The authentication section is by default locked at the IIS level, so if you make any changes from IIS Manager UI, the changes will be written to C:\Windows\System32\inetsrv\config\applicationHost.config. This is called feature delegation.

If you go to the IIS Manager and enable Authentication - Windows *read/write* permission in Feature Delegation, then changes from IIS Manager for windows authentication will be written to web.config. Also you can edit web.config to enable windows authentication.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top