开发者

Suggested directory structure/placement of ASHX files

Thanks to the published ASP.NET MVC conventions, I'm looking much more closely at the idea of universal conventions over configuration for my projects (versus 'home-rolled' conventions, or grabbing from a variety of conventions).

However, I'm not seeing much, if anything, about the preferred location of ASHX files in, for example, ASP.NET MVC projects (as well as Web forms projects).

Is there a recommended directory structure for these? Perhaps the开发者_JAVA技巧re's a published specification with a much larger directory structure accounted for?

My personal convention has been to place these within a top-level Handlers directory, but I honestly haven't personally seen any other projects that really do this.

I suppose, depending upon what it does (for example, generating an image), that one could argue this might go into the Content directory, but it seems this directory is generally used for static files.

(Aside: One could argue that ASHX files are not needed in MVC projects, but based on questions posted here, it appears ASHX files still have their place in MVC projects.)

EDIT: Ignore MVC projects, since I'm suggesting that as one example. How about Web Forms, then?


My personal convention is to not create handlers as ASHX files, but as classes delivering form IHttpHandler interface. I keep them in separate .dll file and register through web.config.

On the other hand all the scenarios described in question you have linked are easy to achieve within ASP.NET MVC Framework, without additional handlers.


For ASP.NET MVC projects there's a good discussion about suggested project/directory structure in the question ASP.net MVC project structure .

For Web Forms it seems Are there naming conventions for ASP.NET web application directory structures? suggests that there is no standard (as of 2008).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜