473,796 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URL Links in Master Page

Hello,

I am having trouble figuring out URL's from my master page.

Here is my setup. I have a default.aspx and default.master file in the root
folder. I have an "images" folder with logos and css files in there. I also
have a "html" folder with more pages in there.

The default.aspx file loads find, but when I open any of the other files
under "html" folder, the linking is off therefore the logo's and css can't
be found.

I tried linking different ways:
~/images/default.gif
/images/default.gif
images/default.gif

I think the problem is when I publish to the server, I have somethink like
http://localhost/test/default.aspx so that http://localhost/test is should
be the base URL, however /images/default.gif will take you to
http://localhost/images/default.gif.

Is there a way do make this work without having to include the "test" in the
URLs? The reason I want to so it this way is because I eventually want to
have versions (ie: 0.1, 0.2, etc) and I don't want to have to change all of
the URLs in my code each time.

Thanks,
Brett
Jan 22 '06 #1
3 1421
> I am having trouble figuring out URL's from my master page.

Here is my setup. I have a default.aspx and default.master file in the
root folder. I have an "images" folder with logos and css files in there.
I also have a "html" folder with more pages in there.

The default.aspx file loads find, but when I open any of the other files
under "html" folder, the linking is off therefore the logo's and css can't
be found.


if I understand your problem correctly then probably the only possibility
would be to copy the "images" folder to the "html" folder so that you have
two copies of it - the first one referenced by pages from the root folder
and the second copy referenced by pages from the "html" folder.

I also have similar situation: a master page references several css/js
files. it works well for html pages from the same directory as the master
page. in case of html pages from other folders, the css/js files are not
loaded because they are treated as if they were referenced from the html
page (not the master page).

the solution I propose to you that involves making a copy of a resource
folder works for me. if there is another option I would be glad to learn it.
the "~/" trick does not work here because the static css/js link is not
processed on the server side.

Regards,
Wiktor Zychla

Jan 22 '06 #2
You need to insure that your image tag is rendered on the server:
<img src="~/Image/AndrewPix.jpg" runat="server" />

<asp:Image runat="server" ImageUrl="~/Image/AndrewPix.jpg" />
--
Andrew Robinson
http://blog.binaryocean.com
"Brett Baisley" <ba*****@hotmai l.com.REM> wrote in message
news:ut******** *****@TK2MSFTNG P15.phx.gbl...
Hello,

I am having trouble figuring out URL's from my master page.

Here is my setup. I have a default.aspx and default.master file in the
root folder. I have an "images" folder with logos and css files in there.
I also have a "html" folder with more pages in there.

The default.aspx file loads find, but when I open any of the other files
under "html" folder, the linking is off therefore the logo's and css can't
be found.

I tried linking different ways:
~/images/default.gif
/images/default.gif
images/default.gif

I think the problem is when I publish to the server, I have somethink like
http://localhost/test/default.aspx so that http://localhost/test is should
be the base URL, however /images/default.gif will take you to
http://localhost/images/default.gif.

Is there a way do make this work without having to include the "test" in
the URLs? The reason I want to so it this way is because I eventually want
to have versions (ie: 0.1, 0.2, etc) and I don't want to have to change
all of the URLs in my code each time.

Thanks,
Brett

Jan 23 '06 #3
Thanks Andrew.

That did the trick
"Andrew Robinson" <ne****@nospam. nospam> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
You need to insure that your image tag is rendered on the server:
<img src="~/Image/AndrewPix.jpg" runat="server" />

<asp:Image runat="server" ImageUrl="~/Image/AndrewPix.jpg" />
--
Andrew Robinson
http://blog.binaryocean.com
"Brett Baisley" <ba*****@hotmai l.com.REM> wrote in message
news:ut******** *****@TK2MSFTNG P15.phx.gbl...
Hello,

I am having trouble figuring out URL's from my master page.

Here is my setup. I have a default.aspx and default.master file in the
root folder. I have an "images" folder with logos and css files in there.
I also have a "html" folder with more pages in there.

The default.aspx file loads find, but when I open any of the other files
under "html" folder, the linking is off therefore the logo's and css
can't be found.

I tried linking different ways:
~/images/default.gif
/images/default.gif
images/default.gif

I think the problem is when I publish to the server, I have somethink
like http://localhost/test/default.aspx so that http://localhost/test is
should be the base URL, however /images/default.gif will take you to
http://localhost/images/default.gif.

Is there a way do make this work without having to include the "test" in
the URLs? The reason I want to so it this way is because I eventually
want to have versions (ie: 0.1, 0.2, etc) and I don't want to have to
change all of the URLs in my code each time.

Thanks,
Brett


Jan 23 '06 #4

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

Similar topics

4
1508
by: Dual Links | last post by:
Hey! I have a problem and i am looking to implenement a simple solution. On our site we have an ecom system, but we also have a backup system incase the first system fails for whatever reason, not likey to happen, but just in case. So for every buy link on our site we have to put the secondary system.
5
2441
by: Michael Herman \(Parallelspace\) | last post by:
1. What are some compelling solutions for using Master/Content pages with Web Pages? 2. If a content area has a web part zone with web parts, what is the user experience like when "editting" the web part page? Does it take place at the page level? ...or the content area level? 3. Where is the Web Part Manager instantiated? ...in the Master Page? ....Content Page? ...elsewhere?
2
1880
by: Steve Franks | last post by:
I am familiar with the fact that you have to use runat=server and links staring with "~/" to ensure proper mapping of paths to relative URLs when using master pages. However this does not seem to work in all cases. For instance, assume I have a "/mysite/images" subdirectory with mybackground.gif and mygif.gif in there. Further assume I have a master page called mastertest.aspx located in /mysite/myfolder".
2
1758
by: Jon Spivey | last post by:
Hi, Using VS 2005/VB.net. I need to add a meta description tag and change a stylesheet link from a page based on a master page. Found this article http://msdn.microsoft.com/asp.net/reference/design/default.aspx?pull=/library/en-us/dnvs05/html/masterpages.asp#masterpages_topic8 Which seems to suggest it's possible (Listing 11 half way down the page) but the method for adding a meta tag Master.Page.Header.Metadata.Add("Description",...
2
1187
by: Mark A. Sam | last post by:
Hello, I can't seem to place images on a master page. I placed the images in a folder in Solutons Exploer and drag them onto the page, but get broken links. Thanks for any help and God Bless, Mark A. Sam
0
1021
by: Learner | last post by:
Hello, we are using Master Pages in asp.net 2.0. Our Master page has three contentplaceholders. On the left most ContentPlaceHolder we have all the links for the navigation of the site. One of the links on it is "Admin" link. Now, if some one with "Admin" Role logs in and clicks on it then the "Admin" link should populate all the other links underneath the "Admin" link. I am looking for some thing like toggel link. Can some one please...
3
1203
by: Samuel Shulman | last post by:
Since the master page is used in pages located in many folders how can I add relative links to the master page? Thank you, Samuel
6
1638
by: Giganews | last post by:
I've got a master page, with stylesheets on it defined as such: <link href="/css/reset-min.css" rel="stylesheet" media="all" /> problem is, I have pages in different folders that link to that master page, so any page that's not in the same folder as the master page, don't display the css. I've tried the following: <link href="~/css/reset-min.css" rel="stylesheet" media="all" /> which didn't work.
6
9162
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %> On the Master Page I have a public property exposed: Public Property ErrorMessage() As String Get Return txtError.InnerText End Get
0
9685
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
10467
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
10244
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
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...
1
7558
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
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5454
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
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
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

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.