views:

283

answers:

3

Hello,

I am a PHP developer moving into an ASP.NET environment. I would like to know the best way to organize the different types of files.

Right now in my project... I have the following:

  • 3 Master Files
  • 5 User Controls
  • 1 Base page class
  • Several Web Forms

The web forms are organized into directories based on the sites structure. But do I just leave the rest of these things on the root level?

The base class can go into the app_code folder.. but where do masters and user controls go?

+1  A: 

I usually make a /MasterPages/ folder for master pages and break content down into things like /Users/ for pages in the "Users" section of the site and /Users/Controls/ for controls for those pages.

So something like this:

../ root
/Admin/
/Admin/Controls/
/JavaScript/ (or a /Includes/)
/MasterPages/
/Users/
/Users/Controls/

etc.

Bryan Denny
A: 

Structure your site like you would if you were using PHP. The directory structure doesn't affect anything* until you get into something like ASP.NET MVP.

* aside from page linking

Gavin Miller
In a PHP site.. I would keep things like Controls and Master Pages outside of the web root. Not sure how to do that here..
majestiq
You can't keep them out of the root (IIS won't serve them) so just use the same directory structure you would have used inside the root.
Dan Diplo
Having logical 'partitioning' of files into folders makes it easier to configure access control (if needed) in the web.config file.
o.k.w
A: 

If you put the master files in any directory. It might be possible to make problem of path. So, If you are putting your web files in any directory then put master files also there. For the user and custom control, Make a directory for them and put them in that directory and go to web.config and make a "Controls" child tag in "Pages" tag like this.

By this thing you no need to put "Register" tag on each page where you are using user controls.

Deepak