Convert File System based WebSites to be HTTP based

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

When creating Visual Studio 2005 Websites you have an option to choose the storage location and the way that the website will be loaded:

> File > New > Website




I often use one of the 2 options here, either File System (when debugging it brings up a new instance of Cassini web server), or HTTP – which when selected let’s you host your website through the IIS web server.


This is all great – it works perfectly in either case, and covers a wide range of developer needs.



But what do you do if in the middle of the project you need to change your project from one to the other?

Let’s examine a situation where we have a File System website which needs to be converted to HTTP website…


Ok, so we have a locally created website, “hosted“ on your local web server (Cassini)… the first thing when converting it to the HTTP type you would naturally go and find the project file and change some properties in it…but wait… ASP.NET 2.0 WebSites (except Web Application projects!) doesn’t have a project file…

What do you do next… you find the solution file, you can find it on a location similar to this one:

C:\Documents and Settings\Your_User \My Documents\Visual Studio 2005\Projects\Your_Project\…


When you edit it, you see information like this:

Project(”{E24C65DC-7377-472B-9ABA-BC803B73C61A}”) = “D:\…\Your_Project\“, “D:\Your_Project “, “{3A5484C0-6B04-48FB-BDF1-88D2A6C42161}”
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.VirtualPath = “/Your_Project
Debug.AspNetCompiler.PhysicalPath = “D:\Your_Project\
Debug.AspNetCompiler.TargetPath = “PrecompiledWeb\Your_Project\”
Debug.AspNetCompiler.Updateable = “true”
Debug.AspNetCompiler.ForceOverwrite = “true”
Debug.AspNetCompiler.FixedNames = “false”
Debug.AspNetCompiler.Debug = “True”
Release.AspNetCompiler.VirtualPath = “/Your_Project
Release.AspNetCompiler.PhysicalPath = “D:\Your_Project
Release.AspNetCompiler.TargetPath = “PrecompiledWeb\Your_Project\”
Release.AspNetCompiler.Updateable = “true”
Release.AspNetCompiler.ForceOverwrite = “true”
Release.AspNetCompiler.FixedNames = “false”
Release.AspNetCompiler.Debug = “False”
VWDPort = “12898″
DefaultWebSiteLanguage = “Visual Basic”
EndProjectSection
EndProject

Note that this is only a part of the solution file, but a part which interest us the most.

Note also all the paths and places where our project is mentioned (either by name, physical or virtual location)


Now let’s change this to be a HTTP hosted Website:

Project(”{E24C65DC-7377-472B-9ABA-BC803B73C61A}”) = “http://localhost/Your_Project/“, “ http://localhost/Your_Project/“, “{352053F2-DDA1-4C02-B734-DC658AF85E25}”
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.VirtualPath = “/Your_Project
Debug.AspNetCompiler.PhysicalPath = “D:\Your_Project
Debug.AspNetCompiler.TargetPath = “PrecompiledWeb\Your_Project\”
Debug.AspNetCompiler.Updateable = “true”
Debug.AspNetCompiler.ForceOverwrite = “true”
Debug.AspNetCompiler.FixedNames = “false”
Debug.AspNetCompiler.Debug = “True”
Release.AspNetCompiler.VirtualPath = “/Your_Project
Release.AspNetCompiler.PhysicalPath = “D:\Your_Project
Release.AspNetCompiler.TargetPath = “PrecompiledWeb\Your_Project\”
Release.AspNetCompiler.Updateable = “true”
Release.AspNetCompiler.ForceOverwrite = “true”
Release.AspNetCompiler.FixedNames = “false”
Release.AspNetCompiler.Debug = “False”
SlnRelativePath = “D:\development\DNN\DEV040003\
DefaultWebSiteLanguage = “Visual Basic”
EndProjectSection
EndProject

So actually what you need to do from File System to the HTTP model is (this is probably also valid vice-versa… from HTTP to File System model)

  1. Change the relative paths from the start to the http:// valid paths
  2. Remove VWDPort param (and probably other “VWD…*” params)
  3. Add SlnRelative path as noted above


And that should be it!

Something very similar to this worked a colleague of mine with who I’ve looked at this problem this morning.


Filed under: .NET, ASP.NET
Written on: 15 May 2006 ·

kick it on DotNetKicks.com

8 Responses to “Convert File System based WebSites to be HTTP based”

  1. Anonymous wrote:

    Thanks for the info!! It worked perfectly - just as you described.

    August 1st, 2006 at 3:31 pm
  2. Anonymous wrote:

    Seems to have worked for me as well, thanks for the article.

    September 18th, 2006 at 8:50 pm
  3. Anonymous wrote:

    this is damn useful…thanks for the article dude…

    November 24th, 2006 at 3:03 am
  4. Anonymous wrote:

    Takns alot man, very very useful

    March 12th, 2007 at 7:10 pm
  5. Anonymous wrote:

    Many thanks man. This worked perfectly.

    August 2nd, 2007 at 9:05 am
  6. Anonymous wrote:

    Many thanks man. This worked perfectly.

    August 2nd, 2007 at 9:05 am
  7. Anonymous wrote:

    Thank you very much. Just what I was looking for.

    August 20th, 2007 at 4:02 am
  8. Anonymous wrote:

    How to convert HTTP based system to FileSystem based

    October 15th, 2007 at 8:57 am

Leave a Reply