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

Discussion in 'ASP .Net' started by Alex, Feb 3, 2005.

  1. Alex

    Alex Guest

    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
     
    Alex, Feb 3, 2005
    #1
    1. Advertising

  2. Alex

    Patrice Guest

    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

    --

    "Alex" <> a écrit dans le message de
    news:...
    > 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
    >
    >
     
    Patrice, Feb 3, 2005
    #2
    1. Advertising

  3. Alex

    Karl Seguin Guest

    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

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Alex" <> wrote in message
    news:...
    > 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
    >
    >
     
    Karl Seguin, Feb 3, 2005
    #3
  4. Alex

    Alex Guest

    Solved the Root Problem using IIS!!!!!!!

    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
     
    Alex, Feb 4, 2005
    #4
  5. why not use Control.ResolveUrl?
    http://msdn.microsoft.com/library/d...lrfsystemwebuicontrolclassresolveurltopic.asp

    e.x.:
    override void OnLoad(object sender)
    {
    Response.Write("Path=" + ResolveUrl("~/"));
    }
    "Alex" <> wrote in message
    news:...
    > 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
    >
    >
     
    Hasani Blackwell, Feb 8, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,239
  2. Kevin Parkinson
    Replies:
    2
    Views:
    509
    Kevin Parkinson
    Apr 3, 2004
  3. Mathieu Pag?

    could not load type MyProject.Global

    Mathieu Pag?, Aug 12, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,581
    Steve Willcock
    Aug 12, 2004
  4. Rick Osborn
    Replies:
    10
    Views:
    3,959
    Jon A. Cruz
    Feb 8, 2004
  5. hector
    Replies:
    5
    Views:
    413
    CBFalconer
    Dec 5, 2006
Loading...

Share This Page