473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

dynamically determine the base href value

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
3 2658
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
3
by: John Smith | last post by:
Is there a way to get Javascript to obey the <BASE HREF=""> tag? I have some code that redirects a user to a template on a different domain, but it keeps taking me to the current domain. Code...
5
by: George Hester | last post by:
Say I have this in a web page: <center><a href="http://www.microsoft.com">www.microsoft.com</a></center> I can use CSS, the DOM and\or JavaScript to determine the width style.innerHTML.length...
2
by: wjbell | last post by:
I have a piece of javascript I need to modify. Right now it changes a stylesheet in the document between style.css and no_indent.css. These are in the head of my document: <link rel=stylesheet...
2
by: Axel Dahmen | last post by:
HI, I want to dynamically add controls to a web page from within a common base class. Unfortunately, ASP.NET fails with "System.Web.HttpException: The Controls collection cannot be modified...
6
by: Smugsboy | last post by:
Need some help. I would like to create in my site a picture that when a user clicks on it, a javascript code which determines which file is to be downloaded to the user, is ran. My problem is...
11
by: GaryB | last post by:
Hi Guys, I've been battling with this one for hours - I hope that you can help me! My code modifies the <aon a page, from a standard document link into a link with a tailored onclick event. ...
2
by: jmarendo | last post by:
Hello, After reading through the "Table Basics - DOM - Refer to table cells" example at mredkj.com , I modified the code for my own purposes. In the modified version, I create a hyperlink and...
6
by: _Who | last post by:
I use the code below to change to a style sheet that has: body { ....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...

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.