Re: Page and Images not found on Localhost



You'll always have to address it as localhost, that simply is the name of
the local loopback adapter and just represents the ip address 127.0.0.1.
When you set the project directory in IIS to be an application, then it is
the root for anything under it. In the scenario where projectA is an
application, but projectB isn't set as an application, the root of projectA
resolves to localhost/projectA. For projectB it would be localhost since the
root application is the first application in the hierarchy.

You shouldn't need to publish to the root if the links and images are
crafted correctly. For links you'll need to either use completely relative,
or use the ~/ to denote it as relative to the application root, but also you
must make sure that the runat="server" attribute is set. A URL such as
/images tells it to use the root from the domain name or IP address, not the
root from the application.


--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"John Kotuby" <johnk@xxxxxxxxxxxxx> wrote in message
news:%23%23qmAgrVHHA.600@xxxxxxxxxxxxxxxxxxxxxxx
Mark,

Thanks again...

I created an application in IIS manager for the c:\Development\Project
virtual web folder and the application name came back as "Project".

I still need to reference http://localhost/project to get to the default
page, it appears. And still the links are broken.

Should I be able to access the site now without using "localhost" in the
URL, or does creating an application set the Root of the site as the
"Project" folder?

It seems that VS2005 is still looking at //localhost as the Root folder.
Driving me nuts... but I can continue to work by publishing the site to
the root of another IIS server in the office.

... John

"Mark Fitzpatrick" <markfitz@xxxxxxxxxx> wrote in message
news:urnzIzqVHHA.1200@xxxxxxxxxxxxxxxxxxxxxxx
Keep in mind, a virtual directory doesn't make it the root of a site. You
have to ensure that your directory is marked as an application. To do
this go into the management control console (MMC) for IIS. Find the
directory, right-click on it and select properties. Make sure that under
the Home Directory there is an application created in the Application
Settings area. If not, click the create application button.

ASP.Net doesn't care what the directory is, but if it's not marked as an
application it looks to the root application or the one immediately above
it for URL references as well as the bin directory.


--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"John Kotuby" <johnk@xxxxxxxxxxxxx> wrote in message
news:%23TTLloqVHHA.1552@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,

Maybe this is a simple problem found in ASP.NET 2.0 course 101, but I
must have missed it. When I create a page in Visual Web Developer and
use URLs like "/images/picture.gif " or a link like <a
href="../../Search/page.aspx">,
everything works fine as long as I publish the site to a root web like
http://localhost.

However, I am developing on my local C drive in c:\development\project.
I have created a virtual web site from that folder in IIS. To access it
I type in http://localhost/project.

Here's the problem. When I try to either run the website in IE7 using
http://localhost/project or debug the website from within VS2005, either
on the "default site" or the selected site http://localhost/project, I
lose all my images, stylesheets and even end up with broken links. But
on a Root website evrything is fine.

For example I get 404 File not found http://localhost/search/page.aspx,
when the resource is actually at
http://localhost/project/search/page.aspx.

I have tried using "~/images/picture.gif" and that doesn't work
either... same with the URL paths.

Somebody said I had to create a virtual Domain out of the
c:\development\project folder, but I don't know what he meant. Also, it
takes forever to "publish' the website to the root server. It would be
so much faster if I could just debug in the development folder right
after making and compiling a change.

Thanks to all....







.


Quantcast