469,604 Members | 2,376 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,604 developers. It's quick & easy.

How can I run the "Development server" w/o a virtual path? (root)

I have a web application that I want to run using the "ASP.NET
Development Server" when I am working locally.

When I go to do this however, I don't see an option to set the Virtual
Path. By default it creates a virtual path that is the same name as
the folder that holds my app, e.g. "/MyWebApp", but in this case the
app I am trying to run is a root website application, so there are lots
of relative URLs that are expecting /images, or /styles or /javascript,
not /MyWebApp/images etc.

Is there a way that I can configure this to run w/o the virtual path?

Apr 12 '06 #1
2 1620
Hi,

Try using the tilde character to refer to you application root. It's a
shotcut for HttpRuntime.AppDomainAppVirtualPath.

For example, reference you images folder as:
~/images

Note that this only works for some server-side controls.

HTH,

Chris

Apr 12 '06 #2
Yea we had done this where we can, but it isn't reall feasible to do
this for every html / js / image href on a site.

You basically have to insert inline code into every path something like
this:

<link href="<%=page.ResolveUrl("~/css/style.css")%>"type="text/css"
rel="stylesheet">

Really a pain.
I found another solution in case anyone is interested:

http://www.chrismay.org/2006/04/12/R...hFromRoot.aspx

I got it from ScottGu.

Apr 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by manatlan | last post: by
3 posts views Thread by Mikkky | last post: by
4 posts views Thread by SpaceMarine | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.