Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: VS.NET
Expertise: beginner
Aug 4, 2003



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Creating an ASP.NET Web Application in a physical folder of your choice

When you create a new ASP.NET Web Application, VS.NET by default creates a folder with the specified application name under the Visual Studio Projects folder (typically under :\Documents and Settings\\My Documents\Visual Studio Projects), and a folder with the same name under :\Inetpub\wwwroot. In the first folder it creates just the solution files (.sln and .suo), while all the ASP.NET project's source files (.aspx, .vb, .config etc.) go into the second folder.

However, you usually want to keep all your projects under a common folder, and have the source files together with the solution files (so that's easier to move everything to another computer, for example), whether they are Windows or Web application, and thus don't like VS.NET's default behavior. It would be preferable to have the possibility to specify a virtual and a physical folder when you create the web application, but unfortunately this is not possible from the New Project dialog window.

The solution is easier than what you may think, though. Say that you want to create a web application named MyWebTest, and that you want to place all the source files (not just the solution files) under c:\My Projects\MyTestWeb. Here are the steps to follow:

  1. Create a Blank Solution in c:\My Projects\MyTestWeb, so that the solution files will be placed in a new folder with this name and in this location.
  2. From the IIS administration console create a new virtual directory named MyTestWeb that points to the physical folder created above. (Alternatively, you can create the virtual folder from Windows Explorer, through the Web Sharing page of the Properties dialog for the physical directory.)
  3. Add a new project of type ASP.NET Web Application to the blank solution, and in VS.NET's New Project dialog use MyWebTest as project name. VS.NET recognizes that a virtual folder with that name is already present, and use it for the project, even if it points to a physical location that is different to that VS.NET would have used by default.
Marco Bellinaso
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date