Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > dynamically determine the base href value

Reply
Thread Tools

dynamically determine the base href value

 
 
Guoqi Zheng
Guest
Posts: n/a
 
      01-13-2005
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.



 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      01-13-2005
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" <(E-Mail Removed)> wrote in message
news:eNe0lgY%(E-Mail Removed)...
> 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.
>
>
>



 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      01-13-2005
try:

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

-- bruce (sqlwork.com)

"Guoqi Zheng" <(E-Mail Removed)> wrote in message
news:eNe0lgY%(E-Mail Removed)...
| 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.
|
|
|


 
Reply With Quote
 
Karl Seguin
Guest
Posts: n/a
 
      01-13-2005
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" <(E-Mail Removed)> wrote in message
news:%23bkssHZ%(E-Mail Removed)...
> try:
>
> <base id="baseUrl" runat=server />
>
> -- bruce (sqlwork.com)
>
> "Guoqi Zheng" <(E-Mail Removed)> wrote in message
> news:eNe0lgY%(E-Mail Removed)...
> | 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.
> |
> |
> |
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically determine base classes on instantiation Thomas Bach Python 18 08-18-2012 10:36 AM
Re: Dynamically determine base classes on instantiation MRAB Python 0 08-15-2012 09:36 PM
BASE HREF and A HREF="#" onclick="..." Vincent van Beveren Javascript 2 07-06-2006 08:33 AM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
Problem: Setting MSIE iframe innerHTML change relative href/src to absolute href/src Soren Vejrum Javascript 4 07-05-2003 01:47 PM



Advertisments