473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
Sep 26 '07 #1
5 1555
...'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
Sep 26 '07 #2
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" <Mi**@discussions.microsoft.comwrote in message
news:4A**********************************@microsof t.com...
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

Sep 26 '07 #3
"Brian K. Williams" <wi*******@xgentracker.comwrote in message
news:ec**************@TK2MSFTNGP02.phx.gbl...
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

Sep 26 '07 #4
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" <Mi**@discussions.microsoft.comwrote in message
news:4A**********************************@microsof t.com...
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

Sep 27 '07 #5
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" <Mi**@discussions.microsoft.comwrote in message
news:4A**********************************@microsof t.com...
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


Sep 27 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Craig Ringer | last post by:
Hi folks I'm a bit of a newbie here, though I've tried to appropriately research this issue before posting. I've found a lot of questions, a few answers that don't really answer quite what I'm...
5
by: aladdinm1 | last post by:
Hi All, I have an annoying trouble with binary serialization. I have a windows forms application which works like a server and keeps sending data to its clients. The data is serialized before...
6
by: Terry Bell | last post by:
We've had a very large A97 app running fine for the last seven years. I've just converted to SQL Server backend, which is being tested, but meanwhile the JET based version, running under terminal...
1
by: Novice | last post by:
I'm afraid I will incur the wraith of Mr. Powell on this one - but I did read his #1 FAQ and some others and I still can't figure this out. I created this little c# app. and I have a PictureBox...
5
by: AAguiar | last post by:
I have an asp.net project where the code behind the aspx page calls a c# class which makes calls to a managed static C++ class. The C# class works fine when the asp net worker process starts, when...
7
by: TJoker .NET | last post by:
I'm developing an VB.NET Windows Forms application that uses CR for VS.NET (original version shipped with VS.NET 2002 - my VS.NET has the latest SP installed, no SPs for CR). My reports get their...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
4
by: Markus Stoeger | last post by:
Hi, I have a problem with Application.Run() when Windows is shutting down. Please have a look at the copy&paste example program below. The application has no forms. It has only got a notify...
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
3
by: =?Utf-8?B?Q2hhZCBTY2hhcmY=?= | last post by:
I have a 3 page ASP.NET web application that is using an asp:Wizard control on the main page. There is no authentication (completely open) and all processesing is done on this single page. I have a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.