Re: How to remove virtual path from root url of dev web server?



Juan,

I apologize. Either I am being very stupid about this or am doing a poor
job explaining the problem...

I tried what you just posted an the images are not found if I use the
"images/whatever.gif" format. As I mentioned in that post, that approach
would require even folder where a page ran from to have a images subfolder
with the images in there. "images/whatever.gif" means relative to the dir
I'm in now, go one step deeper into the images directory. So I'm not sure
how you are saying that "images/whatever.gif" will always take you to the
root (/images) images folder. Basic html says that does not work.

Try this basic exercise and I think you'll see exactly the challenge I am
experiencing:

1) take any project within VS.NET 2005 beta 1 running with the local dev web
server it uses by default (not IIS)

2) create a folder off the root called "steveimages" and place any graphic
in there

3) create a folder off the root called myproducts. Inside of this folder
create a basic .aspx web form that just has a basic HTML table with a
background image and point it to your image in the steveimages folder, like
this:
<table border=0 width=100 background="images/something.gif">
<tr><td>this is a test</td></tr>
</table>

4) Run the page. The image will not be in the table. Look at the logs and
you'll see a 404 with it trying to find images/something.gif.

> <table border=0 width=100
> background="http://yourserver.com/yourapp/images/something.gif";>

That works ust fine but only in development. As soon as you publish this to
a real IIS server where "yourapp" is not part of the root, it breaks. Code
it instead as <table border=0 width=100
background="http://yourserver.com/yourapp/images/something.gif";> and then it
works ok in dev but breaks in production. This is the point of what I've
been trying to say all along.

I do agree its a HTML issue, but one caused by the VS.NET dev web server
that insists on appending an application name in the URL.

To further illustrate that this is indeed a significant issue, see this
article http://www.codeproject.com/aspnet/Multisite.asp . This also
highlights similar issues. However using the type of approach the author is
referring to would require me to write a HttpModule that rewrites the
request dynamically. That would work just fine, but it would require me to
run this in production and I do not want to put all requests through an
HttpModule in production.

Can you see what I am driving at here? I cannot understand how many others
are not tripping over this same thing.

Thanks,

Steve

"Juan T. Llibre" <nomailreplies@xxxxxxxxxxx> wrote in message
news:OQUuJcYuFHA.664@xxxxxxxxxxxxxxxxxxxxxxx
> re:
>> Yes, but doesn't that force me to always have an images folder within
>> each section of my site?
>
> No. You only need one "images" folder for each *application*.
> You should have separate image folders for different apps.
>
> You can use a fully qualified path, too.
>
> <table border=0 width=100
> background="http://yourserver.com/yourapp/images/something.gif";>
>
> This is an HTML issue and not an ASP.NET issue.
>
>
>
> Juan T. Llibre
> ASP.NET MVP
> ASP.NET FAQ : http://asp.net.do/faq/
> ==========================
>
> "Steve Franks" <please@xxxxxxxxxxxxxxxxx> wrote in message
> news:NeudnTgA4dSsC7XeRVn-qQ@xxxxxxxxxxxxxx
>>> Use : <table border=0 width=100 background="images/something.gif">
>>>
>>> *Notice there's no leading slash...*
>>>
>>> That is a relative URL to the images subdirectory of your application,
>>> no matter where the application itself is located.
>>>
>>
>> Yes, but doesn't that force me to always have an images folder within
>> each section of my site?
>>
>> For example my directory structure needs to be set up like this:
>> /
>> /companyinfo
>> /productinfo
>> /productinfo/productA
>> /productinfo/productB
>> /freestuff
>>
>> So now let's say I have to reference the table background image from page
>> /productinfo/productA/details.aspx. If I'm using:
>> <table border=0 width=100 background="images/something.gif">
>>
>> Then don't I have to have a /productinfo/productA/images folder that
>> contains something.gif.
>>
>> Then let's say I have to reference this background image from page
>> /companyinfo/about.aspx. If I'm using:
>> <table border=0 width=100 background="images/something.gif">
>>
>> Again won't I have to have a /companyinfo/images folder that contains
>> something.gif.
>>
>> So every folder where a aspx resided would need to have its own images
>> folder, and that folder would wind up replicating all the other image
>> folders. That would be messy and a maintenance issue.
>>
>> Do you see the challenge here, or perhaps I am just completely missing
>> the boat? It seems though that with the relative "images/something.gif"
>> format a images folder will be required in every folder that contains a
>> page that references the images. I certainly do not want that- I'm
>> looking for a solution so that I can have one common images folder that
>> is shared and accessible as needed from every page in the site regardless
>> of what directory it resides in.
>>
>> Please let me know what you think. Thanks Juan you have been a big help!
>>
>> Steve
>
>


.



Relevant Pages

  • Re: How to remove virtual path from root url of dev web server?
    ... Why do you develop in the root of your development server? ... the possibility of having additional applications in your server. ... > even folder where a page ran from to have a images subfolder with the images in there. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Master Page background image only visible from pages in root directory
    ... if you have your master.page in your root folder all the children must be in ... aspx folder could be several, ... and for all images all you need to do is: ... On the master page is ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: viewing in Firefox requesting Authentication, trying to rerout
    ... - open html folder and replace the previous index.htm file (yes, ... don't understand is how Publisher is writing that code. ... Are you inserting a code fragment to import your images or just inserting ... Be sure to compress your graphics before you upload again. ...
    (microsoft.public.publisher.webdesign)
  • Re: Pages not uploading
    ... Do the images now load on your home page? ... Publisher, and write the links yet once again. ... folder on your C drive where you directed your HTML output when you Publish ... index.htm file and the index_files folder from your webspace, and upload the ...
    (microsoft.public.publisher.webdesign)
  • Re: jpg file will not display (load)
    ... in a folder along with your mentioned images, in which case that would NOT ... be floating around in the root directory. ... I am using a simple src command to display a few jpg files. ...
    (microsoft.public.publisher.webdesign)

Loading