469,609 Members | 1,687 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Using virtual directories for common directories (scripts, images, styles, etc.)

Hi,

(sorry for the crosspost, I wasn't sure which was the best place to
put this).

I was just thinking about something and wondered if any of you has
some ideas about this.

I'm using the NetAdvantage component suite from Infragistics for my
web applications. When installing they create several virtual
directories for the scripts and images directories that their
components use. That way e.g., when you drop a control on a form, and
the imagedirectory property is by default set to /ig_images/ it
automatically finds the images, no matter where the webform is located
in the hierarchy of the website.

I find this a clever idea. I've never done this and never seen a
website that does this, but it sounds like a good idea.

I mean, I have a web application with several subdirectories, user
controls, script/style/images directories etc. etc. It seems like a
good idea to turn my images, scripts, styles directories into virtual
directories, so that I can access them from anywhere within my web
application with simply the virtual directory name, not having to
worry anymore about those relative paths (../../).

I know about the "~" to access the virtual root, but I've had some
problems with that, especially when the web application is not in a
virtual directory but in its own website.

To make it short, it seems like all advantages, but are there any
disadvantages?

Thanks,
Jeffry
Nov 17 '05 #1
2 4044
Virtual directory only means that the directory doesn't physically reside
under the application's directory. Your server side code could care less
whether a directory is virtual or not. So no, it's not a clever idea as a
virtual directory /style is referenced exactly the same way as real
directory /style.

What kind of problems did you have using ~/path? Remember that you need to
call ResolveUrl("~/path") in places where that's not called automatically...

Jerry

"Jeffry van de Vuurst" <go****@vandevuurst.com> wrote in message
news:56*************************@posting.google.co m...
Hi,

(sorry for the crosspost, I wasn't sure which was the best place to
put this).

I was just thinking about something and wondered if any of you has
some ideas about this.

I'm using the NetAdvantage component suite from Infragistics for my
web applications. When installing they create several virtual
directories for the scripts and images directories that their
components use. That way e.g., when you drop a control on a form, and
the imagedirectory property is by default set to /ig_images/ it
automatically finds the images, no matter where the webform is located
in the hierarchy of the website.

I find this a clever idea. I've never done this and never seen a
website that does this, but it sounds like a good idea.

I mean, I have a web application with several subdirectories, user
controls, script/style/images directories etc. etc. It seems like a
good idea to turn my images, scripts, styles directories into virtual
directories, so that I can access them from anywhere within my web
application with simply the virtual directory name, not having to
worry anymore about those relative paths (../../).

I know about the "~" to access the virtual root, but I've had some
problems with that, especially when the web application is not in a
virtual directory but in its own website.

To make it short, it seems like all advantages, but are there any
disadvantages?

Thanks,
Jeffry

Nov 17 '05 #2
Hmmm, you've got a point there. I guess I was a bit confused because I'm
used to developing my sites in virtual directories inside my Default Web
Site. That way you always have to work from the virtual root and you cannot
simply say /style, but you'd have to say /website1/style or something like
that.

Now that I'm using separate IIS websites for every site, I simply can use
/style.

I didn't know about ResolveUrl(), I'll take a look at that.

Thanks for your information.

Regards,
Jeffry

"Jerry III" <je******@hotmail.com> wrote in message
news:#O**************@TK2MSFTNGP10.phx.gbl...
Virtual directory only means that the directory doesn't physically reside
under the application's directory. Your server side code could care less
whether a directory is virtual or not. So no, it's not a clever idea as a
virtual directory /style is referenced exactly the same way as real
directory /style.

What kind of problems did you have using ~/path? Remember that you need to
call ResolveUrl("~/path") in places where that's not called automatically...
Jerry

"Jeffry van de Vuurst" <go****@vandevuurst.com> wrote in message
news:56*************************@posting.google.co m...
Hi,

(sorry for the crosspost, I wasn't sure which was the best place to
put this).

I was just thinking about something and wondered if any of you has
some ideas about this.

I'm using the NetAdvantage component suite from Infragistics for my
web applications. When installing they create several virtual
directories for the scripts and images directories that their
components use. That way e.g., when you drop a control on a form, and
the imagedirectory property is by default set to /ig_images/ it
automatically finds the images, no matter where the webform is located
in the hierarchy of the website.

I find this a clever idea. I've never done this and never seen a
website that does this, but it sounds like a good idea.

I mean, I have a web application with several subdirectories, user
controls, script/style/images directories etc. etc. It seems like a
good idea to turn my images, scripts, styles directories into virtual
directories, so that I can access them from anywhere within my web
application with simply the virtual directory name, not having to
worry anymore about those relative paths (../../).

I know about the "~" to access the virtual root, but I've had some
problems with that, especially when the web application is not in a
virtual directory but in its own website.

To make it short, it seems like all advantages, but are there any
disadvantages?

Thanks,
Jeffry


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Purple Haze | last post: by
13 posts views Thread by Bryan Harrington | last post: by
5 posts views Thread by Leszek | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.