devxlogo

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

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 SettingsMy DocumentsVisual Studio Projects), and a folder with the same name under :Inetpubwwwroot. 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 ProjectsMyTestWeb. Here are the steps to follow:

  1. Create a Blank Solution in c:My ProjectsMyTestWeb, 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.
See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist