Changing "virtual path" of Visual Web Developer Web Server

I'm developing a web application and want to avoid having to use a virtual path when executing the internal web server.

Currently I have a web site named "website". When I start the web server it will automatically setup a server on some port e.g. 269 and with a virtual path of "website". So I'm able to access the site via:
However I would like to access it via this url instead:
and I can't see it should be a problem since the port is unique. I need this in order to use absolute paths in my HTML pages. I do this in order to ease the rearrangement of files e.g. if I have an HTML file in this location:
I'm able to refer to a .css file (in a 'css' folder from the root) using:
<link href="/css/mycssfile.css" />
I don't have to update this reference if I decides to move the "myfile.html" under e.g. "projects" instead of under "projects/test". I don't want to use urls such as "../../css/mycssfile.css".
Does anyone know how to change the "Virtual Path" part of the Visual Web Developer Web Server? That would solve my problem. Alternatively I could deply it to a virtual site under IIS but I don't want to do this during development.
7/27/2004 7:27:03 PM 3977 articles. 0 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 21

Try using the ~ shortcut for your links.  Instead of '/projects/test/', use '~/projects/test/'.  ~ is a shortcut for the ApplicationPath of the site, 'website' in your example.

This is good because it makes your site more portable. You can develop on /website on your dev machine, FTP it to your production server on the root , and they both work. The '~' figures out the correct relative path for you.
One thing though, this only works for server controls, such as NavigateUrl Properties in the HyperLink/ButtonList/HyperLinkColumn (in the GridView). It also works for your CSS <link> tags in your head if your head has a runat="server" on it.
I wish the '~' would resolve to an absolute path, however.
Oh, and if you need the absolute path for a non-server control, use Request.ApplicationPath:
Just a thought...
7/28/2004 5:00:51 AM
Create a new web project, in the Location input field you write http://localhost. But when doing this the web project will be located at the localhost. So if you do it for the next web project, it will override the existing one.

If you want to use IIS instead of the internal web server, you can select the Browse button when you create a new web site, and choose Local IIS.
Another solution is to use the "~" in the path (Will only work for server controls but will later also work for html controls).
<asp:Image ImageUrl="~/images/image.gif" runat="server"....>
The "~" will be translated to the virtual path. When this control is rendered during the runtime it will be:
So by using "~" you don't need to worry about entering the name of the virtual path.
/Fredrik Normén - fredrikn @ twitter

Microsoft MVP, MCSD, MCAD, MCT

My Blog
7/28/2004 7:18:27 AM
Thanks. I'm already using ~ for my server controls and it works great. When you say "...but will later also work for html controls" does this mean it will work for standard (no "runat=xxx") html code such as this?

<link href="~/projects/test/mycss.css" />
If that's the case it's really good and I'll just temporarily create an html filter which will replace any "~/" with "Request.ApplicationPath". And then phase this out when it's a core feature in ASP.NET.
7/28/2004 11:04:28 AM
The "~" will work for HTML control marked with runat="server". This will probably work in beta 2. That is what I have heard.
/Fredrik Normén - fredrikn @ twitter

Microsoft MVP, MCSD, MCAD, MCT

My Blog
7/28/2004 1:33:41 PM

the head section is not responding to the runat server can you suggest anything ?

6/9/2005 10:48:55 AM
If I understood your question, open Solution Explorer and clique over root item (top most item). Then, in Properties Window, change the option Virtual path. I, usually, left just "/".
6/21/2007 5:17:45 PM

Similar Artilces:

"Visual Web Developer Web Server" and Web Services
I like the new "Visual Web Developer Web Server" (Do you want suggestions for a longer name!) but I have an issue with using it to host a Web Service. Whenever the Web Service is recompiled and run it ends up with a different port number. Therefore, it seems that any references to that WS in other applications are invalidated and need to be re-established when it's run again. Is there a way of pinning the port number, or am I missing something? CheersNick Grattan, MSDN Regional Director, Ireland. Software Paths Limited. Hi Nick, the internal server is used for local...

Difference between "Visual Studio 2005 Professional" and "Visual Web Developer 2005 Express Edition"
I would like to build a web application for my department.  But I found that both tools can be used to build a ASP web site.  What is the difference between these two tools ?  Do they function the same ?  You can review this online features matrix between all visual studio versions  Hosam Kamel Remember to click on Mark as answer on the post that helped you Have a look here Thanks----------------------------------------------------------...

"visual web developer does not support creating web sites on a Sharepoint Web Server"
I get this message when I try to create a web site using VS2005 using HTTP, not the file system. "visual web developer does not support creating web sites on a Sharepoint Web Server". Anyone know how to fix this?  Thanks Added info for the above post:I am running Windows XP locally and simply am trying to create a web site in VS2005 using HTTP.  I am not using Visual Web Developer, nor do I have it installed on my machine.The error message mentions Visual Web Developer, so I wanted to clarify that I'm running VS2005 and not VWD.Thanks This is the third report I've s...

Upgrading from "Visual Web Developer 2005 Express Edition Beta 2" to "Visual Studio 2005 Beta 2"
Newby question: I am learning ASP.NET and downloaded "Visual Web Developer 2005 Express Edition Beta 2" in order to practice and learn the ropes.I just received "Visual Studio 2005 Beta 2" and would like to upgrade. However, I haven't found any reference to removing "Visual Web Developer 2005 Express Edition Beta 2" before installing "Visual Studio 2005 Beta 2".Should I remove it?What do I need to back up before doing so?Thanks in advance,Ira I believe you can install VS on top of VWD. They, in fact, can coexits (although they will share some files).Thanks----------------------------------...

Visual web developer 2005 express to visual web developer 2008 express
 I created a project(web site) in vwd 2005 on Win XP. Upon trying vwd 2008 on Vista home premium, and opening the project and selecting to convert to 3.5 .Net, the formatting is not correct. All images are sent way over to the right. Everything else works fine.Anybody else have this problem, or similar?TIA Този уебсайт е твърде бавен. Мисля, че IIS 7 не е конфигуриран правилно. Моля, премахнете банери по-горе. Rendering difference is not a result of conversion. 2008 designer is completely different from 2005, there is no common code. 2005 designer was based in IE6 while 2008 is b...

Can I develop our company's internal application with "Visual Web Developer 2005 Express Edition"
Dear All, Can I develop our company's internal WEB application with "Visual Web Developer 2005 Express Edition"? Any constraint or strict if using "Visual Web Developer 2005 Express Edition"? For example, user connections / database size (we are going to use mdb not sql server express). We are going to develop a simple Job Request management system for our department, are there any template download for reference (IT help desk).  Regards, Owen   Visual Web Dev 2005 does not have any limitations that it imposes that I know of.  It's actually quite fully featured-...

Visual Studio 2005 Profiler "Launch Error: The web.config file xxx\web.config has been changed and backup information was lost."
Hi,  I am experiencing this error when trying to start a Visual Studio 2005 profiling session (Instrumentation) for my ASP.NET 2.0 web application.  I could not find any information regarding this issue and have no idea what might cause the problem, as the Visual Studio 2005 profiler already worked with that very same application, a couple of weeks ago. Anyone? Thanks in advance! Hello, Can you tell me if you found a solution for the issue because I'm experimenting the same issue ? Thanks !...

Publishing "Personal Web Site Starter Kit", Visual Web Developer 2005 on IIS 5.1 in Windows XP 2002 sp2
Dear IIS GurusI am trying to publish the "Personal Web Site Starter Kit" provided as an example with "Visual Web Developer 2005"  as a Virtual Directory on IIS 5.1. I host IIS 5.1 on my development mashine running Windows XP professional 2002 with service pack 2.On browsing the virtual directory I get the following error message: "Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable.  Please hit the "Refresh" button in your web browser to retry your request. Administrator Note: An error message detailing th...

Visual web developer 2005 express crashes on "save all"
Hi all,after a few minutes of working with vwd, and saving my site by clicking the "save all" icon in the toolbar (or on auto-save), vwd often crashes.My system:AMD 1400+ Athlon320 MB ram40 GB HarddriveWindows XP SP2The following message is shown in the event log:Faulting application vwdexpress.exe, version 8.0.50727.42, stamp 4333d0c3, faulting module vswebdesign.dll, version 8.0.50727.42, stamp 4333ec87, debug? 0, fault address 0x001708ac.I already tried replacing my memory, but it didn't help.Does somebody know what's up?TIA,Bram  The first thing to determine is, ...

"Visual Studio .NET cannot create or open the application. Web site 'http://localhost/2373/Labs/Lab071' not started on this Web server. "
i wanted to create a New Project, with Visual Basic Projects as Project Type, and ASP.NET Web Application as the selected Templates. However, there was an error message pop up saying these: "Visual Studio .NET cannot create or open the application. Web site 'http://localhost/2373/Labs/Lab071' not started on this Web server. " How may i overcome it? Is 2373 already a directory in your web root? How about Labs? It might have something to do with subdirectories, have you tried creating one just off the route? Ala: http://localhost/labs071 ? You might want to try to see if tha...

How to change "File System" web site to "HTTP" Web site
I created a new web site as file based "File System". How can I change this same site to "HTTP" based web site. When createing a new website notice the Location pulldown box contains 3 options (File System, HTTP, FTP) But I do not see how to change my "File System" web site to "HTTP" when the project is alredy created and open. Please advise!! Well, you can open IIS, create a new website. Set its home directory to the Web folder of your site. Then go and create a new project using http. I don't really think you can convert between File Syst...

Is that need to upload "global.asax", "web.config" file to web server?
hi is my problem......... Is that need to upload "global.asax", "web.config" file to web server? let say my main form is "WebForm1.aspx, after i upload WebForm1.aspx to webserver, Is that need to upload "global.asax", "web.config" or other file to the website? Hi, You need to upload your web.config file. If you are making use of your global.asax, then you need to upload the same. Making use, per say, you are storing some application variables etc., in the global.asax.vb or .cs files. Note that you don't nee...

Deploying web developed with Visual Web Developer Express & SQL Server Express?
I'm working with Visual Web Developer 2005 Express Edition and SQL Server Express Edition to create a website.  I read recently that the express edition does not have deployment capability.  Is that correct or did I mis-read something?  If it does not have this capability, is there a tutorial somewhere showing how to deploy with all the proper security elements and connection strings intact?I'm new at this, so need lots of hand-holding.  Thanks!Bruce I'm not sure what you read or what in any way would indicate any database having or not having "deployment capability".&n...

I really Need Help with " Microsoft Visual Web Developer 2005 Express Edition" with Password Recovery !
I created a Database type in Microsoft Visual Web Developer 2005 Express Edition that users can register them selves and create pass and store their email....etc..  And I made an Option for them to Recover their Password but after that it asks their Username then Secure Question and then after that instead of sending the password to their entered email it Give me an error...Could anyone Please! Help me..... I really need to know how to let it send the password automatically to their saved email address...And another thing which is very important " How should i upload my files to the Ser...

Web resources about - Changing "virtual path" of Visual Web Developer Web Server -

Resources last updated: 11/23/2015 12:12:19 PM