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

dynamically determine the base href value

P: n/a
Dear sir,

On some of my pages, I used a <base href="http://www.meetholland.com/">

I need to dynamically determine the base href value to different URL based
on user session.

I am thinking to use <base id="baseUrl" runat=server>, it seems not to
work. It returns an error of missing </base> but base tag does not need
</base>

How can I achieve this?? Thannks in advanced.

Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Guoqi:
I agree this is a serious problem....not only does the <base> element not
"need" a closing element, it's strictly forbidden....

The only solution I can think of is that you create your own server control:

Something like:

public class HtmlBase : HtmlGenericControl {
private string href;
public string Href {
get { return href; }
set { href = value; }
}
public HtmlBase(object o) {}
protected override void Render(HtmlTextWriter writer) {
writer.Write("<base href=\"");
writer.Write(href);
writer.Write("\">");
}
}

you can then use it by
[a] registering the control:
<%@ Register TagPrefix="HtmlBase" Assembly="ASSEMBLY NAME GOES HERE"
NameSpace="NAMESPACE GOES HERE" %>

[b] using it:
<HtmlBase:HtmlBase id="X" runat="Server" href="some value" />

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Guoqi Zheng" <no@sorry.com> wrote in message
news:eN****************@TK2MSFTNGP15.phx.gbl...
Dear sir,

On some of my pages, I used a <base href="http://www.meetholland.com/">

I need to dynamically determine the base href value to different URL based
on user session.

I am thinking to use <base id="baseUrl" runat=server>, it seems not to
work. It returns an error of missing </base> but base tag does not need
</base>

How can I achieve this?? Thannks in advanced.

Nov 19 '05 #2

P: n/a
try:

<base id="baseUrl" runat=server />

-- bruce (sqlwork.com)

"Guoqi Zheng" <no@sorry.com> wrote in message
news:eN****************@TK2MSFTNGP15.phx.gbl...
| Dear sir,
|
| On some of my pages, I used a <base href="http://www.meetholland.com/">
|
| I need to dynamically determine the base href value to different URL based
| on user session.
|
| I am thinking to use <base id="baseUrl" runat=server>, it seems not to
| work. It returns an error of missing </base> but base tag does not need
| </base>
|
| How can I achieve this?? Thannks in advanced.
|
|
|
Nov 19 '05 #3

P: n/a
Bruce, the problem with this is that it'll get rendered as
<base href="something"></base>

but the specifications clearly state that in HTML the end tag is "forbidden"
(obviously in XHTML it's absolutely necessary).

--
MY ASP.Net tutorials
http://www.openmymind.net/
"bruce barker" <no***********@safeco.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
try:

<base id="baseUrl" runat=server />

-- bruce (sqlwork.com)

"Guoqi Zheng" <no@sorry.com> wrote in message
news:eN****************@TK2MSFTNGP15.phx.gbl...
| Dear sir,
|
| On some of my pages, I used a <base href="http://www.meetholland.com/">
|
| I need to dynamically determine the base href value to different URL based | on user session.
|
| I am thinking to use <base id="baseUrl" runat=server>, it seems not to
| work. It returns an error of missing </base> but base tag does not need
| </base>
|
| How can I achieve this?? Thannks in advanced.
|
|
|

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.