Last post Nov 29, 2010 04:19 PM by mk31762
Nov 27, 2010 10:52 PM|mk31762|LINK
I have a 3.5 app with a subfolder containing numerous documents. I want to control access to all files in this subfolder via an ASHX handler. My file system looks like this:
The content of the web.config in the files folder is simple:
This works fine on my WinXP / IIS6 developement box, but doesn't work at all when I upload it to my IIS7 / shared hosting account (GoDaddy). I know it doesn't work because I can access every file in the subfolder - the restrictions I wrote in my ASHX code-behind
aren't taking affect at all.
I've lost about 36 hours now trying to figure this one out. I would be happy to fax someone a beer for some help on this one.
Nov 28, 2010 01:51 AM|Ahmed Moosa|LINK
did you use code-behind (Handler.cs ) or mixed ?
why not using Authorization ? and what does ( path="*" ) means ? is it all extension ?
Nov 28, 2010 08:59 PM|mk31762|LINK
Thanks for responding. I used a code-behind file. Authorization isn't an option. I am rewriting a classic ASP app that uses custom authorization. The customer doesn't want to make all of his clients switch, so we're going to keep the custom authorization
system - which means I have to customize file access as well.
And, yes, path="*" means all files.
I have a feeling that something is wrong with my web.config file. I am moving from IIS6 to IIS7 and I think that maybe I'm missing something. When I bring up the ASHX file directly in a browser it works fine. That leaves me to believe that the handler
isn't being invoked as directed by my web.config entries.
Nov 29, 2010 04:19 PM|mk31762|LINK
Just as I thought -- it was an IIS7 / web.config issue. For anyone coming here looking for an answer, this article provided the solution for me.