Is there a file-based equivalent to .htaccess in I

2019-07-03 04:19发布

问题:

There are lots of similar questions to this, but they all seem to involve either configuring permissions or installing a plugin.

I'm looking for a solution that is "dumb" - i.e. to allow the code to be deployed from source control and automatically have access to certain paths blocked, without anyone needing to configure the server.

I only need directory & file blocking, none of the other abilities that .htaccess has.

Just to be clear, we are using ColdFusion, not .NET, and whilst CF has assorted ways to handle its own scripts, it doesn't do anything with non-CFML scripts. (It is possible to do, for example config.xml.cfm, but that is a messy solution that requires updating code, etc.)

(Of course, ideally these directories/files shouldn't even be in the webroot, and if I could switch to Apache or IIS7 I could simply use .htaccess, but those aren't options at the moment.)

My current solution is going to be a readme.deploy.txt that contains instructions on how to manually set the permissions on the relevant files & directories in IIS Manager, but obviously I'd much prefer to avoid human intervention for it - any suggestions?

回答1:

You could create a script that would do this when you cycle through your deployment, like say a scheduled task where you use a PowerShell script or batch script that sets up the enviroment.

With IIS6 this is going to require mucking with the Metabase, which could solve your problem, but it will require scripts to have access to the system metabase and execute system commands or you going to have to learn how to use the ii6 metabase command files

see this This Article

If they have root access maybe it would be wise to just create a installation utility that can tweak the settings for them.

Good luck,

mike



回答2:

Well, for ASP.net specifically you have the .config files which allow you to control some aspect of those web folders. However, I'm not aware of anything like .htaccess for IIS.



回答3:

.NET has Routing which allows you to 'rewrite' paths. The MVC framework has it built in... I'm not sure on how to configure/use it for 'normal' ASP.NET applications.

Update: didn't know you weren't on .NET.

Maybe you're just looking for File/Folder permission settings? Don't know anything about setting those by using a config file...