Can I Reset the Root from localhost/myproject/ to localhost/

A

Alex

does anyone know if it is possible to alter the root address for an asp.net
project as it is messing up my paths.

When I develop locally the address is
localhost/mywebapplication/default.aspx however when the project is uploaded
to a server it is www.mywebsite.com/default.aspx. If I want to use a fixed
path in files I have to alter the address when it is uploaded .

e.g. when the site is being developed locally i can refer to the home page
as /mywebapplication/default.aspx
however on the server I would use /default.aspx

At the moment I have a function that alter the path as required however this
is a big overhead.

I have looked at configuring both vs.net and IIS but not found any
information.

Alex
 
P

Patrice

We have done this for now but because we have also have legacy ASP pages. If
I remember we just moved the site to localhost and we connected to wwwroot$.

That said I wouldn't recommend this for a native ASP.NET application. AFAIK
making the path relative to the root application is really easy with the ~
notation and should be negligable from a performance point of view.

How do you currently fix your path ?

Patrice
 
K

Karl Seguin

Alex:
A better alternative is to let ASP.Net work it's magic.

Instead of hardcoding paths such as /mywebSiteApplication/default.aspx,
simply use:

~/default.aspx which ASP.Net will automatically handle for you

Karl
 
A

Alex

Hi

I figured out how to solve the problem and the answer was so simple when I
started playing around with IIS5.0

If anyone wants to know how to set your asp.net app as the root e.g
http://localhost/default.aspx heres the answer



Open up the IIS Control Panel

Right click on the Default Website node

Choose the Properties menu

Select the Tab marked Home Directory

And set the local path to the path that contains your application.


I cannot believe it turned out to be so easy and so obvious. Obviously you
will have to alter the path when you work on different project however that
s not really a big problem considering the benefits (and no bloody
serverside processing of the ~/folder/ command.


hope this helps

alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top