By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,077 Members | 1,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,077 IT Pros & Developers. It's quick & easy.

Use of Tilde (~) and <LINK>

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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:LiteralControl runat="server" id="linkLit" />

The in Page_Load putting:

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

--

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

* When you think ASP, think 4GuysFromRolla.com!
Nov 18 '05 #2

P: n/a
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:LiteralControl runat="server" id="linkLit" /

The in Page_Load putting

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

--

Scott Mitchel
mi******@4guysfromrolla.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 discussion thread is closed

Replies have been disabled for this discussion.