hi! I haven't been here in a while but I like the changes! I've asked this question @ asp.net forums, but they were completely unhelpful. Maybe it's just me but they could not give me a straight answer. So maybe I'll have better luck here; I find the people in this community very friendly and I don't know why I didn't come here in the first place! here goes:

why does visual studio .net insist on creating new asp.net web applications in a subdirectory of the root? this poses a huge problem because I want to be able to have links and images relative to the site root but the site root is located at c:\inetpub\wwwroot. VS.net makes the root of my asp.net web site c:\inetpub\wwwroot\Project1\ which is fine except if I make a link something like this

<a href="/subdirectory/index.aspx">link</a>

it changes my link to http://localhost/subdirectory/index.aspx instead of http://localhost/project1/subdirectory/index.aspx.

so here is my simple question, how do I get around this straight and narrow path to insanity? Thank you!

-SelArom

Hi SelArom,

An ASP.NET application can be created in the root.

1) In the New Project Window, when you select ASP.NET Application you are prompted for a location. VS.NET may suggest a location like http://localhost/WebApplication1. Just delete the /WebApplication1. VS.NET will create the project in the root with a default name like localhost.

2) Right click the project in the Solution Explorer and rename it to whatever you want.

Hope this works for you.

Cheers,
- Steve

why does visual studio .net insist on creating new asp.net web applications in a subdirectory of the root?

-SelArom

HAH!! you know, I've been struggling with this for almost a YEAR. I couldn't figure out how your were supposed to do ANYTHING if your site is not in the root! I asked at asp.net and they gave me a bunch of crap about editing the HOSTS file and using if then statements to create dynamic links and NOBODY told me I could do this!

And before you say "duh it was obvious" I had actually tried to erase the project name and leave it at "http://localhost/" but when I erased the project name the "OK" button disabled and I couldn't continue. It turns out I also have to erase that last "/" for it to work!

Steve, you are my hero!

-SelArom

Hi SelArom,

Glad I could be of service. :D

Personally, I rarely develop a web app at the root level. I always create it in a subdirectory such as "MyApp". To reference images, etc. I use a root based reference like /MyApp/images/clear.gif. When I deploy to a server I will usually deploy it as the folder MyApp under the root and all the references still work.

Sometimes, you want to deploy to the root, however, and in that case, it would be most convenient if you were also developing your app at the root level.

Cheers,
- Steve

I couldn't figure out how your were supposed to do ANYTHING if your site is not in the root!
-SelArom

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.