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

  • Thread starter Thread starter Joe Kovac
  • Start date Start date
J

Joe Kovac

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
 
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>
 
Mark said:
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"" />"));
 
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...
 
Back
Top