Where to Put Files with an ASP.NET Host!

Environment: ASP.NET

If you're developing your ASP.NET Web application on the server you intend to run it on, you'll find deployment a real doddle: Just hand out the address. Don't worry about the security of your source code: IIS will automatically prevent anyone from downloading it. And when it comes to administration? Simply open the project straight from the Web server and start changing. Super-cool!

However, if you're exposing your ASP.NET Web application through a host account, it's most likely that you'll be given just one "virtual folder," a single application within IIS. That's great if you're just uploading one core application—you merely have to access your folder via FTP, transfer all your application files, access through your URL, and, hey presto!

More likely, however, is that a developer will have multiple ASP.NET Web applications to upload—a root application, for example, and a separate project he wants to place in an "admin" subdirectory. If you do a direct upload from here, the separate admin project will simply not work: its assembly (the DLL file in the Bin folder) is in the wrong location. Try it and you'll see. There are other considerations, too, such as the location of Global.asax.

So, if you're uploading multiple ASP.NET Web applications, follow this three-point checklist for trouble-free deployment:

  1. Create a Bin directory via FTP in your root application folder. Go through every Web application you plan to upload and move its contents (typically your assembly DLL, any referenced components, and a possible debug file) into this one directory.
  2. You're allowed only one Web.config and Global.asax file per IIS application. Choose the files you want to use and upload them directly into your root folder. Make sure you do not upload a Web.config file into any other directory; it'll cause an error in that directory, whereas excess Global.asax files simply get ignored.
  3. Finally, upload the rest of your files (typically just ASPX pages) into the relevant locations and subdirectories, and then attempt to access them via your URL. They'll all automatically find their supporting assemblies in the root Bin folder, plus use the Web.config and Global.asax files you uploaded.

It's always confusing at first, but follow these three steps to take real advantage of your hosting account and save yourself a good few bucks. Good luck!

About the Author

Karl Moore (MCSD, MVP) is an experience author living in Yorkshire, England. He is author of numerous technology books, including the new Ultimate VB .NET and ASP.NET Code Book, plus regularly features at industry conferences and on BBC radio. Moore also runs his own creative consultancy, White Cliff Computing Ltd. Visit his official Web site at www.karlmoore.com.



About the Author

Karl Moore

Karl Moore (MCSD, MVP) is an experience author living in Yorkshire, England. He is the author of numerous technology books, including the new Ultimate VB .NET and ASP.NET Code Book (ISBN 1-59059-106-2), plus regularly features at industry conferences and on BBC radio. Moore also runs his own creative consultancy, White Cliff Computing Ltd. Visit his official Web site at www.karlmoore.com.

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • By providing complete access control with granular permissions, deployment flexibility, mapped drive support, and ability to transfer large files, Egnyte provides a more robust, secure and an affordable file sharing solution for the business than Box

  • Hurricane Sandy was one of the most destructive natural disasters that the United States has ever experienced. Read this success story to learn how Datto protected its partners and their customers with proactive business continuity planning, heroic employee efforts, and the right mix of technology and support. With storm surges over 12 feet, winds that exceeded 90 mph, and a diameter spanning more than 900 miles, Sandy resulted in power outages to approximately 7.5 million people, and caused an estimated $50 …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds