473,757 Members | 10,736 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Master Page background image only visible from pages in root directory

I hope I can explain this well enough to understand. I have a master page
that is used by almost all of the pages in my site. On the master page is a
table. In one of the cells in this table, I have set the background to
display an image that is located in a directory called "images" which is
just off the root directory. Here's the problem:

Any page that is not located in the root directory (where the master page is
located) cannot see the background image. Pages that ARE located in the
root directory can. I have tried using "~/images/filename.jpg" for the
background source but this didn't work. In fact, the only that has worked
so far is to put the full URL ("http://www.mysite.com/images/filename.jpg")
for the background source. I'm still relatively new to ASP.NET 2.0 and I
don't know what (if any) problems using the full URL might cause.

Can anyone suggest a solution (or is using the full URL for this the correct
way to go).

Thanks!
May 24 '06 #1
2 3323
thing of MasterPages like the includes in classic asp...

if you have your master.page in your root folder all the children must be in
the root...

so, the best practce is like this:

root
|--- images
|--- includes
|--- |--- css
|--- |--- js
|--- aspx
web.config
site.map

aspx folder could be several, like
|--- admin
|--- user
|--- master <--- add all the master pages in your website here 4 example
|--- profile
...

it's a clean way to build your website, I always start by the folders, and
then I start workin' in Master.Page and then the content pages.

inside aspx folder (or others) you put all your content pages and the
master page, and for all images all you need to do is:

"../images/...jpg" <-- so get back one folder (you'll be in root) and go to
images folder

if you follow my example, you wwill not having any problem with image links
and you'll have a nice and clean enviroment for your website.

by the way... the best way to have background images is in CSS!
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"news.sbcglobal .net" <gr************ @MAPSONsbcgloba l.net> escreveu na
mensagem news:cb******** **********@news svr29.news.prod igy.net...
I hope I can explain this well enough to understand. I have a master page
that is used by almost all of the pages in my site. On the master page is
a table. In one of the cells in this table, I have set the background to
display an image that is located in a directory called "images" which is
just off the root directory. Here's the problem:

Any page that is not located in the root directory (where the master page
is located) cannot see the background image. Pages that ARE located in
the root directory can. I have tried using "~/images/filename.jpg" for
the background source but this didn't work. In fact, the only that has
worked so far is to put the full URL
("http://www.mysite.com/images/filename.jpg") for the background source.
I'm still relatively new to ASP.NET 2.0 and I don't know what (if any)
problems using the full URL might cause.

Can anyone suggest a solution (or is using the full URL for this the
correct way to go).

Thanks!

May 24 '06 #2
"Bruno Alexandre" <br*********@gm ail.com> wrote in message
news:uW******** ******@TK2MSFTN GP05.phx.gbl...
it's a clean way to build your website, I always start by the folders, and
then I start workin' in Master.Page and then the content pages.


Me too.
May 24 '06 #3

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

Similar topics

5
1719
by: Nalaka | last post by:
Hi, When an image is put on a master page... the url to th eimage is set relatve to the master page. (at least don't know how top set an absolute URL to image) But the when a content page is shown, all images (inclding masterpage) are resoved relative to the content page location. get get around this I copy all master page images to the sub folders too......
2
7026
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no header. I tried to put the link tag in the Master page, but the classes are not recognized in the Content Page. How do I use a StyleSheet with the Content Page? TIA
4
1510
by: JJ | last post by:
My master page contains various graphics that are referenced from the images folder. As long as the container pages are at the same level (ie. the top level looking at the solution explorer in Visual studio 2005) as the master page, the images appear correctly. However, the images do not appear when I am using a container file within a directory. Do I need to use links that aren't relative to the master page so that any content page...
2
1935
by: Samuel Shulman | last post by:
In the MasterPage an images is mapped as follows: ../Images/XYZ.gif and that works fine as long as the forms using this master file are related to the image file in the same way But I have another sub folder where I have more forms using the Master Page and there the image is not found so I tried to change the path to: ~/Images/XYZ.gif and then nothing works Thank you, Samuel
4
4067
by: JimHeavey | last post by:
If on my master page I have an image which is in the image folder. For web pages which are in the "default" directory, the image displays just fine. But if one of my pages which "utilizes" the master page is in a folder called "Fred", the image is not resolved. If I change the reference to the "src" to "../image", then the image is resolved just fine on the web page which is in the "Fred" directory, but does not resolve the location...
7
2026
by: TheLongshot | last post by:
I just recently converted a few pages of my application to using master pages. Problem is, in all of my content pages, the contents are centered. I can't figure out why. The markup in the content page seems to ignore any attempts to manually align right. So what's the deal?
16
1910
by: IfThenElse | last post by:
Hi, I have a web page in a subfolder that inherits a Master page at the root. the webpage in the subfolder can not see the Master page. This is what I have in my webPageThatIsInSubfolder.aspx MasterPageFile="~/myMasterPage.Master" Tried,
1
1444
by: kchaitanya | last post by:
I have created a master page. When I am adding this master page to .aspx files which are in the root directory, it is working fine. When , I am adding master page to .aspx files which are in sub folders , I am getting some problem. Initially, images are not displayed. If I am using runat="server", they are dispalyed. But , I am not getting some text and background color at the place of those text messages. Please check in the below code....
8
1297
by: Cirene | last post by:
I have 1 master page in the root of my website that I would like to share with all pages, even those in my /admin and /client directories. But when pages in the subdir's are viewed the img, css, etc... references are incorrect because they are "root based". Any suggestion as to how to overcome this? Or do I have to create another Master Page for the subdir pages? Thansk!
0
9489
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9737
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7286
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.