iis 7 disable windows auth - asp.net

I setup a test website on my IIS 7.5, I created a Web Application project in VisualStudio and set up a web site in a new application pool in Classic Pipeline Mode.
I have this line in C:\Windows\System32\drivers\etc\hosts:
192.168.50.142 dev.mybigdomain.org.uk
Now if I access my website with http://localhost/testHello/Default.aspx it works fine,
but when I try http://dev.mybigdomain.org.uk/testHello/Default.aspx I get a "Windows security" window asking for authentication, but if enter "administrator" and password it does not recognise them and just asks again.
How can I disable the authentication?

Have you try to change the web.config authentication mode to Forms or None?
<system.web>
...
<authentication mode="Forms">
instead of
<system.web>
...
<authentication mode="Windows">

Related

How to get windows login username in asp.net with single sign on

I want to get windows login username in asp.net with single sign on
I use Global.asax Session_Start
I tried WindowsIdentity.GetCurrent();
İt is working in local but it is not working in IIS. In local DomainName//UserName but in IIS IISAPPPOOL\AppName
In IIS Authenthentication => Anonymous Authenthentication is enabled, ASP.NET Impersonation is disabled, Forms Authentication is disabled also when ı change them application is not working.
My web config is like this
<authentication mode="Windows">
</authentication>
<authorization>
<deny users="?" />
</authorization>
<identity impersonate="true" />
Thread.CurrentPrincipal.Identity.Name; is null
HttpContext.Current.Request.LogonUserIdentity.Name; is IIS IISAPPPOOL\AppName
Context.User.Identity.Name; is null
System.Security.Principal.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal; is null
HttpContext.Current.User.Identity.Name; is null
How can ı solve this
Just disable anonymous authentication and enable windows authentication.
Windows authentication may not be installed. If so, it will not work in any way. Go to server roles on Windows Server or windows features on Windows 7 / 8: complete manual.
I solved it :)
just Configuring IE Trusted Sites with Group Policy Preferences Registry
http://deployhappiness.com/managing-internet-explorer-trusted-sites-with-group-policy/
thanks

windows authentication user coming up blank

I'm attempting to setup windows authentication in an asp.net web application.
Running the following code in an aspx page does not return any info ..
User.Identity.Name.ToString()
Here's what I've done so far:
The server is win 2008 r2. In IIS I've enabled Windows Authentication.
In the Advanced settings of Windows Authentication is Extended Protection:Off and Enable Kernel-mode authentication.
In the web.config of my app, I've got the following:
<authentication mode="Windows"/>
in the system.web node.
In the pageload of the default aspx I have the following..
string userName=" ++ " + User.Identity.Name.ToString() + " ++ ";
ltrTest.Text = userName;
All it returns is " ++ ++ ".
There are a few things you need to do. In your development machine, when running your application locally, you'll need to disable anonymous authentication and enable windows authentication. To do this, you will need to click on your project properties. There, you should see Development Server (I click on my solution, then click the properties tab). You then change the Anonymous Authentication to Disabled and then Windows Authentication To Enabled.
You should then be able to use
string userName = User.Identity.Name;
ltrTest.Text = userName;
This should do it. Hope this helps.
EDIT: I have set up windows auth in a new app and published to IIS and displayed label as username.
Steps:
1)
<authentication mode="Windows">
<forms loginUrl="~/Account/Login" timeout="2880" defaultUrl="~/" />
</authentication>
<authorization>
<deny users = "?" />
</authorization>
This is how I set up the webconfig. If you have
<identity impersonate="true"/>
you will want to remove it.
2)Published to IIS
3)Opened site home in IIS and clicked on Authentication.
4)Disabled Anonymous Authentication and Enabled Windows Authentication.
Note: Windows Authentication is the only thing that is suppose to be enabled. If anything else is enabled(Impersontaion) disable it.
5)On local pc, navigated to the site, typed in credentials in log in prompt
That's it. With labels that I placed in the default.aspx page, I was able to see my username in the format of DOMAIN\User. I also displayed the authentication type and if user was authenticated.
This should work as I have just tested it out.

How to get currently logged in Windows user ID on client side

I have a web application that allows the users to access the pages if their Windows login name to the domain is in the web config's app settings.
For example:
Logged on username: SampleDomain\SampleUser
on Web.config:
<appSettings>
<add key=AuthorizedUsers value="SampleUser,SampleBooger" />
</appSettings>
<authentication mode="Windows"/>
*successful scenario: SampleUser should be able to browse the website.
I was able to do it successfully during development (locally on my machine), but when I deployed it to a server then I try to browse it from my local machine, the Windows login that it gets is NT AUTHORITY\NETWORK SERVICE so it redirects to my customized error page. I, SampleUser, am in the AuthorizedUsers. I should be able to browse it.
Please help me.
Thank you very much.
You need to use ASP.NET impersonation feature.
When using impersonation, ASP.NET applications can execute with the Windows identity (user account) of the user making the request. Impersonation is commonly used in applications that rely on Microsoft Internet Information Services (IIS) to authenticate the user.
Such behavior can be configured in web config using the following code:
<configuration>
<system.web>
<identity impersonate="true"/>
</system.web>
</configuration>
More info: http://msdn.microsoft.com/en-us/library/xh507fc5%28v=vs.100%29.aspx

IIS ignores authorization in web.config

I have a problem using windows authentication and the authorization-tag in web.config for my asp.net application. When I host the application in IIS (both in IIS 6 and IIS 7) the authorization-tag is ignored. When I run the application in asp.net development server that comes with visual studio 2010, it works perfect.
Why will it not work in IIS? And how to solve it?
<system.web>
<identity impersonate="true" />
<authentication mode="Windows" />
<authorization>
<deny users="*"/>
</authorization>
</system.web>
Without seeing the web.config it sounds like you haven't configured IIS. When you use Windows authentication what ASP.NET is expecting is for the web server to do the authentication - so you must configure it to do so, simply putting it in web.config is not enough.
For IIS6:
In IIS Manager, double-click the
local computer; right-click the Web
Sites folder, an individual Web site
folder, a virtual directory, or a
file; and then click Properties.
Click the Directory Security or File
Security tab, and then, in the
Authentication and access control
section, click Edit.
In the Authenticated access section,
select the Windows Integrated
Authentication check box.
Click OK twice.
For IIS7:
Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).
In Features View, double-click Authentication.
On the Authentication page, select Windows Authentication.
In the Actions pane, click Enable to use Windows authentication.

ASP.NET Membership - Can I allow anonymous access and still use automated login using Active Directory?

I hope this is not to paradoxal, but I don't know how this should be done...
I have a VS2008 ASP.NET MVC Project with the following Web.Config entry:
<authentication mode="Windows">
<forms name=".ADAuthCookie" timeout="10" />
</authentication>
This makes the visitor logon automatically with their DOMAIN\username login which they used to logon to Windows. (Right?)
This works with my development server (http://localhost:xxxx), but not with my IIS server (http://localhost). Probably because the development server is 'started' by my local user (which has ActiveDirectory read-rights on the domain) and because IIS is 'started' by the IUSR_WORKSTATION user which does not. (Right?)
If all of the above is true, how can I impersonate the IIS user (for instance to my own username) to solely authenticate the current user with the Windows login name? (like the example below)?
Or should the IUSR_WORKSTATION user be granted ActiveDirectory? read-rights (not preferred as I will be switching servers / IUSR_ users a lot)
<identity impersonate="true" userName="DOMAIN\myuser" password="mypass"/>
<authentication mode="Windows">
<forms name=".ADAuthCookie" timeout="10" />
</authentication>
<identity impersonate="false"/>
Windows authentication is poorly named (IMO). It's not using Windows as the authentication, but rather it delegates the authentication process to IIS. So you need to configure IIS's authentication, which then flows down to ASP.NET
How you do this depends on your version of IIS, in IIS7 expand out the tree and click your web site, then click Authentication and enable Windows Authentication

Resources