473,799 Members | 3,350 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use of Tilde (~) and <LINK>

I just learned about the wonderful ~ in paths in ASP.NET which allows me to reference the APPLICATION root instead of the IIS docroot. Love it! I'm finding that I can use ~ in many places as long as the control in which it's used is set to runat="server". It's very handy.

Here's the problem. I have
<link rel="STYLESHEET " type="text/css" href="/Shared/CSS/Global.css" /
on every page of the site. I REALLY want to be able to locate the href of this link using the ~ so that it's relative to the application root rather than the IIS docroot. But it doesn't seem like there's any way to do that.

Ideas

Ale

Nov 18 '05 #1
2 1798
Alex Maghen wrote:
I just learned about the wonderful ~ in paths in ASP.NET which allows me to reference the APPLICATION root instead of the IIS docroot. Love it! I'm finding that I can use ~ in many places as long as the control in which it's used is set to runat="server". It's very handy.

Here's the problem. I have
<link rel="STYLESHEET " type="text/css" href="/Shared/CSS/Global.css" />
on every page of the site. I REALLY want to be able to locate the href of this link using the ~ so that it's relative to the application root rather than the IIS docroot. But it doesn't seem like there's any way to do that.

Ideas?


How about putting:

<asp:LiteralCon trol runat="server" id="linkLit" />

The in Page_Load putting:

linkLit.Text = String.Format(" <link rel=""STYLESHEE T"" type=""text/css""
href=""{0}"" />", Page.ResolveUrl ("~/Global.css (or whatever)"))
hth

--

Scott Mitchell
mi******@4guysf romrolla.com
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla. com!
Nov 18 '05 #2
Yeah, that's what I'm doin'. Don't love it but it does the job. Thanks

----- Scott Mitchell [MVP] wrote: ----

Alex Maghen wrote
I just learned about the wonderful ~ in paths in ASP.NET which allows me to reference the APPLICATION root instead of the IIS docroot. Love it! I'm finding that I can use ~ in many places as long as the control in which it's used is set to runat="server". It's very handy.
Here's the problem. I have

<link rel="STYLESHEET " type="text/css" href="/Shared/CSS/Global.css" />> on every page of the site. I REALLY want to be able to locate the href of this link using the ~ so that it's relative to the application root rather than the IIS docroot. But it doesn't seem like there's any way to do that.
Ideas


How about putting

<asp:LiteralCon trol runat="server" id="linkLit" /

The in Page_Load putting

linkLit.Text = String.Format(" <link rel=""STYLESHEE T"" type=""text/css""
href=""{0}"" />", Page.ResolveUrl ("~/Global.css (or whatever)")
ht

--

Scott Mitchel
mi******@4guysf romrolla.co
http://www.4GuysFromRolla.co
http://www.ASPFAQs.co
http://www.ASPMessageboard.co

* When you think ASP, think 4GuysFromRolla. com

Nov 18 '05 #3

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

Similar topics

9
2962
by: Francesco Moi | last post by:
Hello. I'm trying to build a RSS feed for my website. It starts: ----------------//--------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91"> ----------------//----------------------
6
17169
by: Todd Peterson | last post by:
I'm encountering some wierd behavior with a <link> tag over an HTTPS connection, vs. an HTTP connection... In an ASP/HTML page on my website, I've add a <link rel="shortcut icon"...> in order to allow the users to add a shortcut (with icon) on their desktop, as well as seeing the icon in the URL. Our development server allows both HTTP and HTTPS connections, but the icon only appears to be available when requesting the page via HTTP???...
2
1815
by: brw | last post by:
Is there a way to dynamically add a link tag to the head block of an ..aspx page? I'm aware that you can add a link tag (or literal control) statically and then dynamically modify the attributes. I'm wondering if there's a way to add the tag from scratch at run time. thanks, Ben
4
4433
by: Jake Barnes | last post by:
Very odd. Check out this RSS feed that my PHP script just built: http://www.tagcastle.com/rss/photography.xml When I had a straight URL in the <link> tag, or the <comment> tag, then "=" character drew an error and caused my XML to be not-well-formed. So I hit it with the PHP command rawurlencode, and now it draws no error, but it no longer works as a link. What did I do wrong?
1
2382
by: Baldoni | last post by:
It's been years since putting together a page. This line in my HTML: <link type="text/css" rel="stylesheet" href="net4801style.css"> gives this problem (via weblint HTML checker): attribute 'TYPE' for <link> is extended markup (use -x <extension> to do this). Where might be found a resource, for simple folk, explaining how to best correct this?
17
1966
by: The Numerator | last post by:
I know a lot about HTML, but all this time I don't know what the <LINK> tags in the head do. There are those that call a stylesheet, favicon, etc. But what about those that state the contents of the page, identify the next and previous page, etc. Do some browsers support them or are they just for organization or something?
4
2025
by: John A Grandy | last post by:
When constructing an RSS 2.0 XML doc , should the <channel><link> element's value be 1. the url of the page the displays the content that the RSS feed describes : fox example: http://www.myecommerce.com/results.aspx/?keywords=mens+dress 2. the url of the page which generates an up-to-date version of the RSS doc :
1
1967
by: Doug.Sheahan | last post by:
I am attempting to parse and xml file using javascript but am running into a problem when parsing a <link></link> pair. For example, the link information in most RSS feeds is given as <link> http://www.something.com/someotherstuff </link> However, when I use item.getElementsByTagName("link"), I get an empty HTMLLinkObject back and if I print the innerHTML property of item, the <link> tag shows up but not the </link> tag. Does anyone...
9
6906
by: Arancaytar | last post by:
I have so far seen two methods for including external resources as CSS stylesheets in a document. The first is this: <link href="/stylesheets/style.css" rel="stylesheet" type="text/css" /> And the second is this: <style type="text/css"> @import "/stylesheets/style.css"; </style>
0
9688
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
9544
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10030
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
9077
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
7570
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
6809
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
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4145
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
2
3761
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.