I am using Form authentication on ASP.NET 4.0 and need to know how it is possible to disable access to all areas of the website (folders/files) except for specific files, such as files in css folder?
only if the user is authenticated, can they access those files.
ahmedilyas
Member
414 Points
586 Posts
Disable access to all files except in certain folders?
Jan 06, 2013 11:11 PM|LINK
I am using Form authentication on ASP.NET 4.0 and need to know how it is possible to disable access to all areas of the website (folders/files) except for specific files, such as files in css folder?
only if the user is authenticated, can they access those files.
ahmedilyas
Member
414 Points
586 Posts
Re: Disable access to all files except in certain folders?
Jan 06, 2013 11:23 PM|LINK
Realised it does not work with txt files which is ok (since I was using that as a test) but for most other files it works.
you can also do it this way:
<location path="ASecureFolder"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location>Pengzhen Son...
Star
8189 Points
842 Posts
Microsoft
Re: Disable access to all files except in certain folders?
Jan 08, 2013 10:24 AM|LINK
Hi,
I think you can try creating a custome HTTP handler for .txt file and add the custom mapping in the app's web.config.
Feedback to us
Develop and promote your apps in Windows Store
ahmedilyas
Member
414 Points
586 Posts
Re: Disable access to all files except in certain folders?
Jan 08, 2013 10:34 AM|LINK
Hi there.
yes you are correct in relation to making a customer HTTP Handler however this would be a little overkill for this scenario :)
But yes, you are also correct!