Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top