473,804 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2680
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 : HtmlGenericCont rol {
private string href;
public string Href {
get { return href; }
set { href = value; }
}
public HtmlBase(object o) {}
protected override void Render(HtmlText Writer writer) {
writer.Write("< base href=\"");
writer.Write(hr ef);
writer.Write("\ ">");
}
}

you can then use it by
[a] registering the control:
<%@ Register TagPrefix="Html Base" Assembly="ASSEM BLY NAME GOES HERE"
NameSpace="NAME SPACE GOES HERE" %>

[b] using it:
<HtmlBase:HtmlB ase 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******** ********@TK2MSF TNGP15.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******** ********@TK2MSF TNGP15.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******** **********@tk2m sftngp13.phx.gb l...
try:

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

-- bruce (sqlwork.com)

"Guoqi Zheng" <no@sorry.com > wrote in message
news:eN******** ********@TK2MSF TNGP15.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
6157
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. "Decimal Number" sometimes serves to distinguish Base 10 numbers, eg "15", from Base 2 numbers, Eg "1111". At other times "Decimal Number" serves to differentiate a number from an integer. For the rest of this post I shall only use either...
3
13972
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 sample: <base href="http://www.example.com"> <SELECT onChange="location=this.options.value;"> <OPTION VALUE="shwspool.html">View Spool Directory</OPTION> <OPTION VALUE="monacc.html">View Monitor Access Log</OPTION>
5
1863
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 of the www.micosoft.com. But how can I tell in pixels how far it is from the left side of the client area using JavaScript? If the browser is resized and the text wraps the distance will change. So I need to determine it dynamically. Thanks. --...
2
2872
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 href=/style.css> <link rel=stylesheet href=/no_indent.css> <link rel=stylesheet href=/style.css> What the code below does is toggle between the two depending on what
2
7367
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 because the control contains code blocks (i.e. <% ... %>)." All of my pages contain these kind of blocks, for several reasons. For one, I don't know any other way to dynamically add header information like e.g. style sheet links to a web page. So, is...
6
1892
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 that I do not know how to make the file that was chosen by the javascript code to be downloaded to the user. I know how to do it statically (using anchor) what I'm looking for is how to do it dynamically. Thanks,
11
3035
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. It works perfectly (assigning the correct images and the correct onclick events to the correct <atags):
2
3390
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 place it in the last cell of each row that I create dynamically using DOM methods. Everything is working well (that is, just like the original example) except for something related to the function behind my link. The link simply calls a function...
6
2561
by: _Who | last post by:
I use the code below to change to a style sheet that has: body { ....
0
9705
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
10320
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...
1
10308
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10073
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
9134
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
7609
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
6846
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
5513
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
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.