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

How to add <base target="_self"> in code behind

P: n/a
Hi!

I want to add
<base target="_self">
into the header section of a aspx page. I want to do this in the code
behind because I use master pages which I do not want to change directly.

Thanks

Joe
May 3 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Joe Kovac" <Jo****@nospam.comwrote in message
news:e2***************************@news.inode.at.. .
I want to add
<base target="_self">
into the header section of a aspx page. I want to do this in the code
behind because I use master pages which I do not want to change directly.
http://msdn2.microsoft.com/en-us/lib....htmlhead.aspx
--
http://www.markrae.net

May 3 '07 #2

P: n/a
Another option:

Have a protected class-level string variable (and assign a value in
Page_Load or inline) in the code-behind:

protected string baseUrl = "<base href=\"_self\">";

And in the .aspx page:

<head>
<%= baseUrl %>
</head>

"Joe Kovac" wrote:
Hi!

I want to add
<base target="_self">
into the header section of a aspx page. I want to do this in the code
behind because I use master pages which I do not want to change directly.

Thanks

Joe
May 3 '07 #3

P: n/a
"Siva M" <sh******@online.excite.comwrote in message
news:C2**********************************@microsof t.com...
protected string baseUrl = "<base href=\"_self\">";
protected string baseUrl = "<base target=\"_self\">";
And in the .aspx page:
In the MasterPage...

--
http://www.markrae.net

May 3 '07 #4

P: n/a
Mark Rae wrote:
"Siva M" <sh******@online.excite.comwrote in message
news:C2**********************************@microsof t.com...
>protected string baseUrl = "<base href=\"_self\">";

protected string baseUrl = "<base target=\"_self\">";
>And in the .aspx page:

In the MasterPage...
Well, I don't want this in the MasterPage as not all pages are
concerned. Therefor I use:

Page.Header.Controls.Add(new LiteralControl(@"<base target=""_self"" />"));

May 4 '07 #5

P: n/a
"Joe Kovac" <Jo****@nospam.comwrote in message
news:a3**************************@news.inode.at...
Mark Rae wrote:
>"Siva M" <sh******@online.excite.comwrote in message
news:C2**********************************@microso ft.com...
>>protected string baseUrl = "<base href=\"_self\">";

protected string baseUrl = "<base target=\"_self\">";
>>And in the .aspx page:

In the MasterPage...

Well, I don't want this in the MasterPage as not all pages are concerned.
Therefor I use:

Page.Header.Controls.Add(new LiteralControl(@"<base target=""_self""
/>"));

Indeed - what I meant was that such things need to end up in the header
section and, since content pages don't have headers...

No biggie...
--
http://www.markrae.net

May 4 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.