List Info

Thread: Problem with Masterpage images and nested folder and site root




Problem with Masterpage images and nested folder and site root
country flaguser name
United States
2007-07-21 09:00:20
Hello

I just started learning how to use MasterPages and I hit my
first road 
block.  I am new to .NET and don't know how to solve this
issue. 

My issue is that I have a master page file in project root
and I have a 
folder called images in the root as well.  I created a new
page in 
another folder in the root called admin that uses the same
masterpage 
file in the project root.

So it looks like this

default.aspx
masterpage.master
/images
/admin/admin.aspx

The default page in the root works find since all the image
links are 
src="images/ but all the images in the admin.aspx are
missing since 
technically the path is src="../images

I tried src="/images/ but this does not work when I use
view in browser 
on my local machine using visual studio 2005.  Is there a
way to set 
that image path globally so that I am able to place
templates wherever I 
want?

Thanks,

Mike

-- 

Mike Elmalem
eFactory Inc.
Main. 905-669-8056 ext 1
Cell. 416-836-9460
Fax. 905-669-8056





--- List Settings ---
http://aspadvice.com/list
s/


RE: Problem with Masterpage images and nested folder and site root
country flaguser name
United States
2007-07-21 12:35:59
Create a global variable say appDir which contains
objRequest.ApplicationPath; Then replace the relative paths,
../images or
images, with <%=appDir%>images/filename.jpg.

We have been using this technique for the past year with no
problems. 

Pam


-----Original Message-----
From: Mike Elmalem - Efactory Inc [mailto:mikeefactory.ca] 
Sent: Saturday, July 21, 2007 7:00 AM
To: aspnetaspadvice.com
Subject: [aspnet] Problem with Masterpage images and nested
folder and site
root


Hello

I just started learning how to use MasterPages and I hit my
first road 
block.  I am new to .NET and don't know how to solve this
issue. 

My issue is that I have a master page file in project root
and I have a 
folder called images in the root as well.  I created a new
page in 
another folder in the root called admin that uses the same
masterpage 
file in the project root.

So it looks like this

default.aspx
masterpage.master
/images
/admin/admin.aspx

The default page in the root works find since all the image
links are 
src="images/ but all the images in the admin.aspx are
missing since 
technically the path is src="../images

I tried src="/images/ but this does not work when I use
view in browser 
on my local machine using visual studio 2005.  Is there a
way to set 
that image path globally so that I am able to place
templates wherever I 
want?

Thanks,

Mike

-- 

Mike Elmalem
eFactory Inc.
Main. 905-669-8056 ext 1
Cell. 416-836-9460
Fax. 905-669-8056





--- List Settings ---
http://aspadvice.com/list
s/



--- List Settings ---
http://aspadvice.com/list
s/


RE: Problem with Masterpage images and nested folder and site root
country flaguser name
United States
2007-07-21 12:18:02
Try using "~/images/". The ~ will take you to the
root of the site.



David Caver


-----Original Message-----
From: Mike Elmalem - Efactory Inc [mailto:mikeefactory.ca] 
Sent: Saturday, July 21, 2007 9:00 AM
To: aspnetaspadvice.com
Subject: [aspnet] Problem with Masterpage images and nested
folder and site
root

Hello

I just started learning how to use MasterPages and I hit my
first road 
block.  I am new to .NET and don't know how to solve this
issue. 

My issue is that I have a master page file in project root
and I have a 
folder called images in the root as well.  I created a new
page in 
another folder in the root called admin that uses the same
masterpage 
file in the project root.

So it looks like this

default.aspx
masterpage.master
/images
/admin/admin.aspx

The default page in the root works find since all the image
links are 
src="images/ but all the images in the admin.aspx are
missing since 
technically the path is src="../images

I tried src="/images/ but this does not work when I use
view in browser 
on my local machine using visual studio 2005.  Is there a
way to set 
that image path globally so that I am able to place
templates wherever I 
want?

Thanks,

Mike

-- 

Mike Elmalem
eFactory Inc.
Main. 905-669-8056 ext 1
Cell. 416-836-9460
Fax. 905-669-8056





--- List Settings ---
http://aspadvice.com/list
s/





--- List Settings ---
http://aspadvice.com/list
s/


RE: Problem with Masterpage images and nested folder and site root
user name
2007-07-21 19:25:54
Keep in mind that ~ only works if the image is a server
control (i.e.,
runat="server"). If not, the ~ is not interpreted
and passed directly on to
the client, which of course does not know what ~ means.

/Rex

-----Original Message-----
From: David Caver [mailtoavidCave
rverizon.net] 
Sent: Saturday, July 21, 2007 1:18 PM
To: aspnetaspadvice.com
Cc: mikeefactory.ca
Subject: [aspnet] RE: Problem with Masterpage images and
nested folder and
site root

Try using "~/images/". The ~ will take you to the
root of the site.



David Caver


-----Original Message-----
From: Mike Elmalem - Efactory Inc [mailto:mikeefactory.ca] 
Sent: Saturday, July 21, 2007 9:00 AM
To: aspnetaspadvice.com
Subject: [aspnet] Problem with Masterpage images and nested
folder and site
root

Hello

I just started learning how to use MasterPages and I hit my
first road 
block.  I am new to .NET and don't know how to solve this
issue. 

My issue is that I have a master page file in project root
and I have a 
folder called images in the root as well.  I created a new
page in 
another folder in the root called admin that uses the same
masterpage 
file in the project root.

So it looks like this

default.aspx
masterpage.master
/images
/admin/admin.aspx

The default page in the root works find since all the image
links are 
src="images/ but all the images in the admin.aspx are
missing since 
technically the path is src="../images

I tried src="/images/ but this does not work when I use
view in browser 
on my local machine using visual studio 2005.  Is there a
way to set 
that image path globally so that I am able to place
templates wherever I 
want?

Thanks,

Mike

-- 

Mike Elmalem
eFactory Inc.
Main. 905-669-8056 ext 1
Cell. 416-836-9460
Fax. 905-669-8056





--- List Settings ---
http://aspadvice.com/list
s/





--- List Settings ---
http://aspadvice.com/list
s/


--- List Settings ---
http://aspadvice.com/list
s/


RE: Problem with Masterpage images and nested folder and site root
country flaguser name
United States
2007-07-24 05:18:49
Using the Image control should not be too difficult.

<asp:Image runat="Server"
ImageUrl="~/images/button.gif" />


Aaron

-----Original Message-----
From: Rex Morgan [mailto:rexrexmorgan.net] 
Sent: Sunday, 22 July, 2007 08:26
To: aspnetaspadvice.com
Cc: mikeefactory.ca
Subject: [aspnet] RE: Problem with Masterpage images and
nested folder and
site root

Keep in mind that ~ only works if the image is a server
control (i.e.,
runat="server"). If not, the ~ is not interpreted
and passed directly on to
the client, which of course does not know what ~ means.

/Rex

-----Original Message-----
From: David Caver [mailtoavidCave
rverizon.net] 
Sent: Saturday, July 21, 2007 1:18 PM
To: aspnetaspadvice.com
Cc: mikeefactory.ca
Subject: [aspnet] RE: Problem with Masterpage images and
nested folder and
site root

Try using "~/images/". The ~ will take you to the
root of the site.






--- List Settings ---
http://aspadvice.com/list
s/


[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )