PC Review


Reply
Thread Tools Rate Thread

ASP.NET/IIS Problem when using ../../ in Application.

 
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      26th Sep 2007
Hi. I have a virtual directory named Vehicles which serves a website. An
..aspx page in the Vehicles directory needs to display an image from a folder
existing one folder above Vehicles.

So I tried this. myImage.ImageURL = "../../image.gif"

And it's not working. Is this because when I use "../" it will only look
inside the Virtual Directory and not outside of it?

Thanks
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      26th Sep 2007
...'s work at iis level, not file. so ../../image is the virtual
directory above your site. a common approach is to have a root vdir
called images then you just:

myImage.ImageURL = "/images/image.gif";

-- bruce (sqlwork.com)

Mike wrote:
> Hi. I have a virtual directory named Vehicles which serves a website. An
> .aspx page in the Vehicles directory needs to display an image from a folder
> existing one folder above Vehicles.
>
> So I tried this. myImage.ImageURL = "../../image.gif"
>
> And it's not working. Is this because when I use "../" it will only look
> inside the Virtual Directory and not outside of it?
>
> Thanks

 
Reply With Quote
 
Brian K. Williams
Guest
Posts: n/a
 
      26th Sep 2007
If you are using an ASP control and not a HTML control then you can use the
"~" in your path instead of ".." like this:
myImage.ImageURL = "~/images/image.gif".

Using the ~ the path will resolve for you.

Regards,
Brian K. Williams





"Mike" <(E-Mail Removed)> wrote in message
news:4ACF8D40-CA63-4244-9697-(E-Mail Removed)...
> Hi. I have a virtual directory named Vehicles which serves a website. An
> .aspx page in the Vehicles directory needs to display an image from a
> folder
> existing one folder above Vehicles.
>
> So I tried this. myImage.ImageURL = "../../image.gif"
>
> And it's not working. Is this because when I use "../" it will only look
> inside the Virtual Directory and not outside of it?
>
> Thanks



 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      26th Sep 2007
"Brian K. Williams" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> If you are using an ASP control and not a HTML control then you can use
> the "~" in your path instead of ".." like this:
> myImage.ImageURL = "~/images/image.gif".
>
> Using the ~ the path will resolve for you.


But not in this particular case, obviously...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      27th Sep 2007
Chances are, IIS is configured to disallow "parent paths," which are
relative paths that lead to a parent directory. This is often (and by
default in IIS 6 and above) configured to prevent specific attacks that use
parent paths to access system directories outside the web site. Using
root-relative paths or virtual paths is your best bet.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Mike" <(E-Mail Removed)> wrote in message
news:4ACF8D40-CA63-4244-9697-(E-Mail Removed)...
> Hi. I have a virtual directory named Vehicles which serves a website. An
> .aspx page in the Vehicles directory needs to display an image from a
> folder
> existing one folder above Vehicles.
>
> So I tried this. myImage.ImageURL = "../../image.gif"
>
> And it's not working. Is this because when I use "../" it will only look
> inside the Virtual Directory and not outside of it?
>
> Thanks



 
Reply With Quote
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      27th Sep 2007
Thank you all for your help with this question!

"Kevin Spencer" wrote:

> Chances are, IIS is configured to disallow "parent paths," which are
> relative paths that lead to a parent directory. This is often (and by
> default in IIS 6 and above) configured to prevent specific attacks that use
> parent paths to access system directories outside the web site. Using
> root-relative paths or virtual paths is your best bet.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
>
> DSI PrintManager, Miradyne Component Libraries:
> http://www.miradyne.net
>
> "Mike" <(E-Mail Removed)> wrote in message
> news:4ACF8D40-CA63-4244-9697-(E-Mail Removed)...
> > Hi. I have a virtual directory named Vehicles which serves a website. An
> > .aspx page in the Vehicles directory needs to display an image from a
> > folder
> > existing one folder above Vehicles.
> >
> > So I tried this. myImage.ImageURL = "../../image.gif"
> >
> > And it's not working. Is this because when I use "../" it will only look
> > inside the Virtual Directory and not outside of it?
> >
> > Thanks

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.Run() problem Joel Microsoft C# .NET 5 18th Oct 2006 06:38 AM
Interesting flickering problem if application's user control is invalidated by external application (e.g. Notepad) sasifiqbal@gmail.com Microsoft C# .NET 2 27th Apr 2006 05:58 PM
Problem in console application using Caching Application Block ams8764 Microsoft Dot NET Framework 1 6th Jan 2006 11:00 AM
application.exit, application.exitthread exit application problem =?Utf-8?B?TWlrZSBTaWx2ZXI=?= Microsoft Dot NET Framework Forms 2 24th Nov 2004 03:14 AM
Printer problem or application problem? Gordon Nelson Printers 3 5th Jul 2003 02:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:32 AM.