I want to set a username and password to a folder in IIS7 so when the users want to see it's file , they have to enter that username and password to see or download the file.
First off, make sure you have the authentication role features installed - basic authentication sounds like what you want. In server manager, right-click IIS, add role features, and install Basic Authentication (under security) if it's not installed already.
In the IIS manager, select a location, open the "Authentication" module, and configure as desired. Disabling Anonymous and enabling Basic is probably where you want to be - it'll be using Windows users, and access to the resources will be controlled by the
NTFS permissions on those resources.
arash nadali
2 Posts
set username and password to a folder in IIS7
Mar 03, 2013 06:19 AM|LINK
Hi everyone
I want to set a username and password to a folder in IIS7 so when the users want to see it's file , they have to enter that username and password to see or download the file.
how can i do it in IIS7?
thanks.
HostingASPNe...
734 Posts
Re: set username and password to a folder in IIS7
Mar 03, 2013 08:41 AM|LINK
Hello,
You could put the following code in your web.config:
<configuration>
<system.webServer>
<security>
<authorization>
<add accessType="Deny" users="?" />
</authorization>
</security>
</system.webServer>
< /configuration>
The other option is to use the IIS console:
- Connect to the site
- Navigate to the directory you want to password protect
- Double click - Authorization Rules
- Click - Add Deny Rule
- In the pop up dialogue box, select - All anonymous users
- Click - OK
Regards
Free ASP.NET Examples and source code.
arash nadali
2 Posts
Re: set username and password to a folder in IIS7
Mar 06, 2013 05:56 AM|LINK
thanks for your answer
your solution allow Athenticated users to download and see the file
but i want set a single username and password for a folder , and when a user whant to download a file
see a popup form to enter username and password.
How can i do this?
Tasmey
69 Posts
Re: set username and password to a folder in IIS7
Mar 07, 2013 05:56 AM|LINK
First off, make sure you have the authentication role features installed - basic authentication sounds like what you want. In server manager, right-click IIS, add role features, and install Basic Authentication (under security) if it's not installed already.
In the IIS manager, select a location, open the "Authentication" module, and configure as desired. Disabling Anonymous and enabling Basic is probably where you want to be - it'll be using Windows users, and access to the resources will be controlled by the NTFS permissions on those resources.