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

Discussion in 'ASP .Net' started by Jeffry van de Vuurst, Jul 30, 2003.

  1. 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
    Jeffry van de Vuurst, Jul 30, 2003
    #1
    1. Advertising

  2. Jeffry van de Vuurst

    Jerry III Guest

    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" <> wrote in message
    news:...
    > 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
    Jerry III, Jul 30, 2003
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:#...
    > 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" <> wrote in message
    > news:...
    > > 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

    >
    >
    Jeffry van de Vuurst, Jul 30, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TGFzc2UgTmlsc3Nvbg==?=

    Multiple bin-directories with virtual directories?

    =?Utf-8?B?TGFzc2UgTmlsc3Nvbg==?=, Nov 9, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    812
    =?Utf-8?B?TGFzc2UgTmlsc3Nvbg==?=
    Nov 9, 2004
  2. Denny
    Replies:
    1
    Views:
    762
  3. Paul F
    Replies:
    4
    Views:
    620
    Mark Fitzpatrick
    Jun 25, 2008
  4. Kevin Walzer

    Re: PIL (etc etc etc) on OS X

    Kevin Walzer, Aug 1, 2008, in forum: Python
    Replies:
    4
    Views:
    370
    Fredrik Lundh
    Aug 13, 2008
  5. John Reye
    Replies:
    28
    Views:
    1,333
    Tim Rentsch
    May 8, 2012
Loading...

Share This Page