Directory structures different on development machine vs. install machine.

Discussion in 'ASP .Net' started by UJ, Sep 22, 2006.

  1. UJ

    UJ Guest

    So I have a project called Fred that's a web site. On my machine, the url is
    http://localhost/Fred/..... On the final resting place it's
    www.fred.com/...

    So how do I make the system so that it will work both in my development
    environment and the delivered web site? For instance - I want to do a system
    transfer somewhere - but I don't want to specify
    "../../LoveItOrLeaveIt.aspx" because the directory structure could change.
    And if I try and do "/LoveItOrLeaveIs.aspx" it works on the delivered site
    but not the development site.

    The only thing I can think of is to make a virtual directory that point to
    the root and then have everything point to that.

    Anybody have any suggestions?

    TIA - Jeff.
     
    UJ, Sep 22, 2006
    #1
    1. Advertising

  2. RE: Directory structures different on development machine vs. install

    Hi,
    You can use the web application root operator (~), which is resolved to the
    root of the current application
    for example: Response.Redirect("~/Folder/sample.aspx");
    Or you can use it in the server controls
    <asp:image runat="server" id="Image1"
    ImageUrl="~/Images/SampleImage.jpg" />
    Regards,
    Mohamed Mosalem


    "UJ" wrote:

    > So I have a project called Fred that's a web site. On my machine, the url is
    > http://localhost/Fred/..... On the final resting place it's
    > www.fred.com/...
    >
    > So how do I make the system so that it will work both in my development
    > environment and the delivered web site? For instance - I want to do a system
    > transfer somewhere - but I don't want to specify
    > "../../LoveItOrLeaveIt.aspx" because the directory structure could change.
    > And if I try and do "/LoveItOrLeaveIs.aspx" it works on the delivered site
    > but not the development site.
    >
    > The only thing I can think of is to make a virtual directory that point to
    > the root and then have everything point to that.
    >
    > Anybody have any suggestions?
    >
    > TIA - Jeff.
    >
    >
    >
     
    =?Utf-8?B?TW9oYW1lZCBNb3NhbGVt?=, Sep 23, 2006
    #2
    1. Advertising

  3. UJ

    UJ Guest

    Re: Directory structures different on development machine vs. install

    Thanks for the info but that doesn't work all the time. One of the things
    I'm trying to do is to make the rollover on a few buttons change the graphic
    image. But if I put ~/Images it doesn't understand it. The only way I've
    been able to make it work is by setting up a virtual directory and reference
    that there.

    Is there a better way to do this?


    "Mohamed Mosalem" <> wrote in
    message news:...
    > Hi,
    > You can use the web application root operator (~), which is resolved to
    > the
    > root of the current application
    > for example: Response.Redirect("~/Folder/sample.aspx");
    > Or you can use it in the server controls
    > <asp:image runat="server" id="Image1"
    > ImageUrl="~/Images/SampleImage.jpg" />
    > Regards,
    > Mohamed Mosalem
    >
    >
    > "UJ" wrote:
    >
    >> So I have a project called Fred that's a web site. On my machine, the url
    >> is
    >> http://localhost/Fred/..... On the final resting place it's
    >> www.fred.com/...
    >>
    >> So how do I make the system so that it will work both in my development
    >> environment and the delivered web site? For instance - I want to do a
    >> system
    >> transfer somewhere - but I don't want to specify
    >> "../../LoveItOrLeaveIt.aspx" because the directory structure could
    >> change.
    >> And if I try and do "/LoveItOrLeaveIs.aspx" it works on the delivered
    >> site
    >> but not the development site.
    >>
    >> The only thing I can think of is to make a virtual directory that point
    >> to
    >> the root and then have everything point to that.
    >>
    >> Anybody have any suggestions?
    >>
    >> TIA - Jeff.
    >>
    >>
    >>
     
    UJ, Oct 24, 2006
    #3
    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. UJ
    Replies:
    2
    Views:
    447
  2. Guy
    Replies:
    0
    Views:
    314
  3. RJGraham
    Replies:
    8
    Views:
    10,403
    Ryan Stewart
    Feb 14, 2004
  4. tweak
    Replies:
    14
    Views:
    2,817
    Eric Sosman
    Jun 11, 2004
  5. Alfonso Morra
    Replies:
    11
    Views:
    751
    Emmanuel Delahaye
    Sep 24, 2005
Loading...

Share This Page