advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Partners & Affiliates
advertisement
advertisement
Tip of the Day
Average Rating: 3.7/5 | Rate this item | 6 users have rated this item.
Tip formerly from VB2TheMax
Expertise: beginner
Language: VS.NET
August 4, 2003
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
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tip here.
Please rate this item (5=best)
 1  2  3  4  5
advertisement
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Help  |   Site Map  |   Network Map  |   About


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers