Sharing images with multiple web sites

G

Guest

Since we are unable to use IIS on our developer workstations due to security
policy, we would like to use the internal web server baked into VS.NET 2005.
The problem that I am currently running into is that we have many web
applications that share common images and I don't know where to put them. I'm
not able to create a virtual directory in "Cassini", so that's not a viable
solution. I also don't want to copy all the shared images under an \images
directory under each web application as this will be an administrative and
maintenance nightmare. We could store these images on a separate server and
reference them via HTTP, but that won't be a nice solution from a deployment
standpoint because we will need to change the code between development,
staging and our production environments. If we use <%=location%> in the tags
to find the location at runtime, then the images won't show up in the
designer. I have searched the internet in vain for a solution, so hopefully
you will have some guidance on this issue. I must be overlooking the obvious.
 
G

Guest

The absolute URL would change from development to staging to production, so I
would then have to go and change all reference before deployment from one
platform to another. I don't like this idea.
 
P

Patrice

My personal preference would be likely still just to automate the copy using
a tool such as "robocopy" (downloable from MS, allows to synchronize
directories) either on demand or at logon time depending on the update
frequency (are they updated so often ?) or as part of the build process.

The application could be also written to accomodate both scenarios (the
location could be configurable, the application could redirect to an
alternate location in dev mode).

You could also try a Windows admin group (you have little know options such
as hardlinks or mount points though I believe it wouldn't work on a network
share).

Good luck
 
G

Guest

I would think this would get very messy because we have 40 web applications
that utilize the same images. A virtual directory would be beautiful, but
unfortunately you can't do that with the web server embedded in VS.NET 2005.
Another problem would be one of source control. These web sites would be a
mixture of source controlled and unbound files. I think this too would get
very confusing.
 
G

Guest

Put a "baseImageUrl" appSettings key in the web.config.
All your image urls would have this prepended. When you "move" the app,
the setting can be changed in only one place.
Peter
 
K

Kevin Spencer

Yes, as long as your web.config at design time is pointing to the actual
locations of the images.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Sequence, Selection, Iteration.
 
G

Guest

Would you please give me a code snippit on this? If this works at design time
I'm ready to roll.
 
K

Kevin Spencer

Hi Jason,

Here's an example from an ASP.Net web application I have worked on:

<add key="ImagePath" value="http://www.airtraveler.com/airtraveler"/>

This is combined with the image file name in the app to create the URL of
the images in the app.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Sequence, Selection, Iteration.
 
P

Patrice

As you wish... It left you with the other option, i.e. just have the
application get the files from a configurable location...
 
G

Guest

I understand the web.config portion, just don't know how to code the aspx
side so that the image will show up in the designer. At runtime (viewed in
browser) the proposed solution will work, but it doesn't seem to work at
design time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top