Re: How to remove virtual path from root url of dev web server?
- From: "Steve Franks" <please@xxxxxxxxxxxxxxxxx>
- Date: Wed, 14 Sep 2005 21:13:07 -0400
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
>
>
.
- Follow-Ups:
- Re: How to remove virtual path from root url of dev web server?
- From: Juan T. Llibre
- Re: How to remove virtual path from root url of dev web server?
- References:
- Re: How to remove virtual path from root url of dev web server?
- From: Steve Franks
- Re: How to remove virtual path from root url of dev web server?
- Prev by Date: Re: requiredfieldvalidator driving me nuts!!
- Next by Date: Re: JavaScript version of VBScript's formatting functions
- Previous by thread: Re: How to remove virtual path from root url of dev web server?
- Next by thread: Re: How to remove virtual path from root url of dev web server?
- Index(es):
Relevant Pages
|
Loading