How do I create a Web Application at the domain root?

  • Thread starter Thread starter David Berman
  • Start date Start date
D

David Berman

Whenever I want to create a C# / asp.net based web site, Visual Studio
always requires a subdirectory for the project. So when I make my site,
for example abcinc.com, the web site ends up at
http://www.abcinc.com/abcinc/ or some other subdirectory. How can I
just setup a project for http//www.abcinc.com/ ?

Thank you! This is driving me nvts!




<img src="http://www.sen.us/mirror/SENLogo_62_31.jpg">
Meet people for friendship, contacts,
or romance using free instant messaging software! See a picture you
like? Click once for a private conversation with that person!
http://www.sen.us
 
David -

That drove me nuts as well.

I figured out a solution, which I will describe below. However, there is a
limitation.

If you are using anything other than Windows 2000 Server, then you have a
problem in that the OS doesn't allow you to create multiple websites on your
computer. Thus, you can't create www.abcinc.com as a new website, because
there is already a default website.

In that case, you can either accept the fact that you can only develop one
website at a time, or you can go through some pains to fool Windows into
letting you create multiple websites.


To solve your problem, you should create the website manually using the IIS
control program (i.e. through the MMC)

Then, add an entry to your HOSTS file that looks like this:
127.0.0.1 www.abcinc.com

Now you can create the solution in Visual Studio .NET, and when it asks you
for the URL, just point it to www.abcinc.com
 
I just develop the app in the subdirectory, then copy it into the root
directory when I'm done.
 
Thank you for your response, but that's not really what I meant. I am
running windows 2000 server and I can setup multiple web sites. The
problem I'm having is that when I try to create a project with Visual
Studio, it asks for a url, and the url it requires you to enter must
have a subdirectory. I can't say, create a new web project at
http://www.abcinc.com, I have to specify /something at the end. How do
I create a web application with asp.net in the root directory?

Thanks,
David



<img src="http://www.sen.us/mirror/SENLogo_62_31.jpg">
Meet people for friendship, contacts,
or romance using free instant messaging software! See a picture you
like? Click once for a private conversation with that person!
http://www.sen.us
 
David Berman said:
Thank you for your response, but that's not really what I meant. I am
running windows 2000 server and I can setup multiple web sites. The
problem I'm having is that when I try to create a project with Visual
Studio, it asks for a url, and the url it requires you to enter must
have a subdirectory. I can't say, create a new web project at
http://www.abcinc.com, I have to specify /something at the end. How do
I create a web application with asp.net in the root directory?

You don't. Not really.

VS.NET assumes you're creating applications under the root. Support for
creating and working with applications at the root is spotty at best and in
my opinion should be avoided. Hopefully they'll fix this for version 2.
 
David Berman said:
Whenever I want to create a C# / asp.net based web site, Visual Studio
always requires a subdirectory for the project.

David... I'm not trying to aggravate you but maybe there is an advantage to
this? I'm not certain I see the harm in keeping the root clear of as much
nonsense as possible. Among other things it (seemingly) would permit you
post "test" versions in other folders and to switch those to "live" when it
was determined to work.

Can you post an example of what the downside is?

Tom
 
I create a new website in IIS on my production server, give it its own IP
address, then copy the file over into that directory. so it's still in
c:\inetpub\wwwroot\sitename, but you still go to it by pointing to
www.sitename.com, if your dns is set up to correctly point www.sitename.com
to the IP address you specified.

There's no need to stick everything in the root to accomplish this
 
Thank you everyone for your responses.

I don't want to put everything in my asp.net project in the root, but
maybe I want my web.config in there and my default.aspx in there to
start my application. I want to make a site who's sole purpose is to
provide one application. I tried developing in a subdirectory and then
copying it that that seems like an unnecessary step for me because I'm
not opening up the site to the public until its finished, so I would
like to develop to the root for some things. For example, you go to the
home page and there is a logon box on it and maybe some announcements.
Right now, I make my site in a subfolder and then the default page is
basically a redirector, which seems like an inefficient step.

Shouldn't we have the power to choose where we want the project?

Thanks again for your responses I'm learing somethings.




Meet people for friendship, contacts,
or romance using free instant messaging software! See a picture you
like? Click once for a private conversation with that person!
<a href="http://www.sen.us"><img
src="http://www.sen.us/mirror/SENLogo_62_31.jpg">
</a>
 
David Berman said:
Shouldn't we have the power to choose where we want the project?

I'll answer them in reverse order. Sure we should... it looks like somebody
has pointed you to an MSDN article which might answer the question. On the
other hand...
Right now, I make my site in a subfolder and then the default page is
basically a redirector, which seems like an inefficient step.

It isn't that inefficient (using the scientific definition of "that") and
the indirection gains you something. It isn't entirely like the indirection
used in OOP development at the cost of some CPU cycles. It will always lose
the efficiency argument as it is definitely less efficient if you only
measure response time. Considering what that one level of indirection can
gain you (if taken advantage of) my solution was to add it when in the case
of .ASP it wasn't built-in.

A simple parameter can (for instance) take you to a test version or to
various non-public "sub-sites". In any case it seems that MS has a solution
for you.

Tom
 
Steve C. Orr said:
Here's the information you requested on creating a web app in the root web:
http://support.microsoft.com/default.aspx?scid=kb;en-us;303845

Interesting article.

But there are implications for team development that people need to keep in
mind. If you create such a project and check it in to source control, it
will be stored there with a reference to the exact site you created it in.
When someone else opens the project from source control, that's what it will
open.

This is fine if you really wanted everyone to work with the files at
http://someserver/, or even http://localhost, but if different developers
need to work on more than one project at a time, there will be problems. For
instance, developers not working on Server versions of Windows can only have
one web site, so the question is "which http://localhost were you referring
to?"
 
John Saunders said:
This is fine if you really wanted everyone to work with the files at
http://someserver/, or even http://localhost, but if different developers
need to work on more than one project at a time, there will be problems.

John... well that's good then :-) at least in terms of my reasons for
avoiding the placing of projects directly into the root. I just see more
"upside" than "downside" in keeping it isolated. Certainly during
development and probably also when deployed.

That's my 2 cents anyway,
Tom
 
Tom, that was a great explanation and a really great idea. I really
think your idea of having optional paramters to redirect to a test or
development environment. Slick!

Steve, thank you for the link. That's exactly what I needed. According
to this article, it appears that what I want to do can be done when
using file share mode, but perhaps not when using frontpage server
extensions to connect. I'll do some more searching on MSDN.

David


Meet people for friendship, contacts,
or romance using free instant messaging software! See a picture you
like? Click once for a private conversation with that person!
<a href="http://www.sen.us"><img
src="http://www.sen.us/mirror/SENLogo_62_31.jpg">
</a>
 
Back
Top