Chaging localhost root folder

Last post 12-12-2008 7:09 AM by CurtWRC. 6 replies.

Sort Posts:

  • Chaging localhost root folder

    12-12-2008, 6:41 AM
    • Participant
      1,067 point Participant
    • CurtWRC
    • Member since 01-19-2006, 5:28 AM
    • Nuneaton, England
    • Posts 919

     Hi,

    In the solution explorer when I click on 'View In Browser' when I have right clicked on the root folder Index.aspx file, the URL I have in the browser is 'http://localhost:1999/Coding/Index.aspx'. 'Coding' is the folder my project is stored in. However this causes issues because then if I have the following HTML it doesn't recognise that the Images folder is inside the Coding folder because its not the root folder Tongue Tied

     <img src="/Images/Logo.jpg" />

    Does anyone know why this is happening?

    Thanks for your help

    Curt.

    Regards, Curt
  • Re: Chaging localhost root folder

    12-12-2008, 6:47 AM
    • Participant
      999 point Participant
    • Mauro_net
    • Member since 10-26-2006, 5:54 AM
    • Posts 220

     Visual Studio debugger doesnt use the same virtual path you app will end up using.

    Try running your app from IIS and you will see everything works smooth.

    Then, there are a couple solutions for what you're getting.

    1. Dont use "/" to say root. Try to use relative paths whenever you can

    2. From now on, you refer to the root as ~/ (in aspx pages)

    I also think there's a way to  adjust this behaviour in VS but the behaviour you're getting is actually correct. It is also good to prepare your apps to run "from everywhere" in a directory structure.

     

    Regards,

    Mauro

  • Re: Chaging localhost root folder

    12-12-2008, 6:49 AM
    • Participant
      1,467 point Participant
    • muhammedsalimp
    • Member since 09-20-2007, 5:58 AM
    • Calicut, Kerala, India
    • Posts 232

    Check IIS for your root folder. if Coding is a sub folder within that ,  please try whether this is working

    <img src="../Coding/Images/Logo.jpg" />

    Regards,
    Muhammed Saleem P

    ---------------------------------------------
    Please do not forget to click "Mark As Answer" on the posts that helped you.

    Happy Programming !!!

  • Re: Chaging localhost root folder

    12-12-2008, 6:49 AM
    • All-Star
      59,903 point All-Star
    • mudassarkhan
    • Member since 02-28-2008, 5:28 AM
    • Mumbai, India
    • Posts 10,551
    • TrustedFriends-MVPs

    Hi,

    localhost:1999 is a virtual asp.net web server. It is executing the code in the same folder when u have kept ur project. Issue will be with the url of the images. If the images folder are outside ur code folder use src = "../images/logo.jpg" and if its withing ur code folder type src ="images/logo.jpg"

  • Re: Chaging localhost root folder

    12-12-2008, 6:51 AM
    • Participant
      1,067 point Participant
    • CurtWRC
    • Member since 01-19-2006, 5:28 AM
    • Nuneaton, England
    • Posts 919

     basically all I'm asking is can localhost:1999/Coding change to localhost:1999 so that Coding is included making that the root folder?

    Regards, Curt
  • Re: Chaging localhost root folder

    12-12-2008, 7:00 AM
    Answer
    • All-Star
      59,903 point All-Star
    • mudassarkhan
    • Member since 02-28-2008, 5:28 AM
    • Mumbai, India
    • Posts 10,551
    • TrustedFriends-MVPs

    no it cant since localhost is ur machine 1999 is port and Coding is the virtual directory. So it cant be changed If u reanme ur folder to something else then instead of coding that name will appear.

    Also VS creates virtual directory since the actal localhost that is ur machine is reserved by IIS at port 80

  • Re: Chaging localhost root folder

    12-12-2008, 7:09 AM
    • Participant
      1,067 point Participant
    • CurtWRC
    • Member since 01-19-2006, 5:28 AM
    • Nuneaton, England
    • Posts 919

     Okay thats a shame :/

    Thanks anyway.

    Regards, Curt
Page 1 of 1 (7 items)