Hello. Can someone give me some help (or point me to some help) on password protecting a directory with asp? I know how to protect single asp pages, but I also have some .pdf and .doc files that need to be protected, so I need to just protect the whole directory I guess. I asked the hosting company to set it up, and they said they could only do one username/password combination, and if I want more than that I need to do it in asp myself. (I have about 20 username/passwords).
You use the Attributes property to read or set a file’s attributes, such as read-only, archive, hidden, and so on). The attributes of a file are numeric values and a file can have multiple attributes. In this case, the file’s attribute is the numeric sum of the values of the individual attributes.
fileAttibutes = thisFile.Attributes
The attribute variable can have any of the following values:
To find out whether a file is ready-only, use this statement:
IF thisFile.Attributes and 1 Then
‘The files is Ready-only
To delete the file, you must first change the ready-only attribute of the file with a statement like the following one:
If thisFile.Attributes And 1 Then
thisFile.Attributes = thisFile.Attributes + 1
Normally, when we set a file’s attributes, we don’t reset the existing ones. For example, you many choose to add the hidden attribute from a file that has its ready-only attribute set. To turn on the hidden attribute without affecting the other ones, use a statement such as:
thisFile.Attributes = thisFile.Attributes + 2
or you can use this:
thisFile.Attributes = thisFile.Attributes Or 2
To remove a specific attribute, first find out wether this attribute is already set, and then subtract its value for the Attributes property’s value. To remove the Hidden attribute, use a structure like the following one:
If thisFile.Attributes And 2 Then
thisFile.Attributes = thisFile.Attributes – 2
Im sure you can access the Folder attributes using the above method but using this line:
Set FSYS = CreateObject(“Scripting.FileSystemObject”)
set ThisFolder = FSYS.GetFolder(FolderName)
That's great information, but I don't think it really does what I'm looking for. I may end up embedding the pdf files in asp pages and just converting the .doc files to asp. That way I can check for authorized users within the pages. I can't believe there's not some other way of doing this though.
I'm trying to convert a site that a client had on another server, and they were using .htaccess to protect the directory, but I understand this doesn't work with windows servers.