473,396 Members | 1,713 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,396 software developers and data experts.

Change header info in Master Page (2.0)

Hello,

I have the following in my Master Page that I am using as a redirect
template:

<head id="headRedirect" runat="server">
<meta id="metaRedirect" http-equiv="Refresh" content="2;
URL=http://www.mysite.com/" />
<title>Page Redirect</title>
</head>

My question is how can I change the URL that is referenced in the meta data
from the content page? Also, Can you add meta data? With .NET 1.1 I could
use the following: Master.Page.Header.Metadata.Add("Keywords", "lws,services
technologies," & strTitle), but this doesn't seem to work in 2.0. Any
assistance with this would be greatly appreciated.

Thanks, sck10
Aug 8 '06 #1
4 5003
htmlmeta class site:msdn2.microsoft.com

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"sck10" <sc***@online.nospamwrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl...
Hello,

I have the following in my Master Page that I am using as a redirect
template:

<head id="headRedirect" runat="server">
<meta id="metaRedirect" http-equiv="Refresh" content="2;
URL=http://www.mysite.com/" />
<title>Page Redirect</title>
</head>

My question is how can I change the URL that is referenced in the meta
data from the content page? Also, Can you add meta data? With .NET 1.1 I
could use the following: Master.Page.Header.Metadata.Add("Keywords",
"lws,services technologies," & strTitle), but this doesn't seem to work in
2.0. Any assistance with this would be greatly appreciated.

Thanks, sck10

Aug 9 '06 #2
Hello Steve,

I'm abit confused about the following things you mentioned:

=================
With .NET 1.1 I could
use the following: Master.Page.Header.Metadata.Add("Keywords",
"lws,services
technologies," & strTitle), but this doesn't seem to work in 2.0
==================

Master Page is only available in ASP.NET 2.0/.NET 2.0 but not 1.1, what's
the "1.1" you mentioned?
As for how to modify the <meta tag's content field in code, I think you
can directly use the content page's Page.Header.FindControl to reference
the meta tag defined in master page(the Meta tags in master page will be
added into concrete page's Header.Controls at runtime). For example, for
your master page template(as below):

===========
<head id="headRedirect" runat="server">
<meta id="metaRedirect" http-equiv="Refresh" content="2;
URL=http://www.mysite.com/" />
<title>Page Redirect</title>
</head>
==============

In concrete page(applied the above master page), you can use the following
code to modify its content:

================
protected void Page_Load(object sender, EventArgs e)
{
HtmlMeta meta = Page.Header.FindControl("metaRedirect") as HtmlMeta;

meta.Content = "2;URL=http://msdn2.microsoft.com/";
}
================
Please feel free to let me know if the above code works or if you have any
other concerns.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 9 '06 #3
"sck10" <sc***@online.nospamwrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl...
With .NET 1.1 I could use the following:
Master.Page.Header.Metadata.Add("Keywords", "lws,services technologies," &
strTitle), but this doesn't seem to work in 2.0. Any assistance with this
would be greatly appreciated.
I'm sure I'm not alone in wondering how you were using MasterPages before
v2... :-)
http://msdn2.microsoft.com/en-us/lib...asterpage.aspx
Aug 9 '06 #4
Thanks Steve.
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:mE**************@TK2MSFTNGXA01.phx.gbl...
Hello Steve,

I'm abit confused about the following things you mentioned:

=================
With .NET 1.1 I could
use the following: Master.Page.Header.Metadata.Add("Keywords",
"lws,services
technologies," & strTitle), but this doesn't seem to work in 2.0
==================

Master Page is only available in ASP.NET 2.0/.NET 2.0 but not 1.1, what's
the "1.1" you mentioned?
As for how to modify the <meta tag's content field in code, I think you
can directly use the content page's Page.Header.FindControl to reference
the meta tag defined in master page(the Meta tags in master page will be
added into concrete page's Header.Controls at runtime). For example, for
your master page template(as below):

===========
<head id="headRedirect" runat="server">
<meta id="metaRedirect" http-equiv="Refresh" content="2;
URL=http://www.mysite.com/" />
<title>Page Redirect</title>
</head>
==============

In concrete page(applied the above master page), you can use the following
code to modify its content:

================
protected void Page_Load(object sender, EventArgs e)
{
HtmlMeta meta = Page.Header.FindControl("metaRedirect") as
HtmlMeta;

meta.Content = "2;URL=http://msdn2.microsoft.com/";
}
================
Please feel free to let me know if the above code works or if you have any
other concerns.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
4
by: Alan Silver | last post by:
Hello, I downloaded and registered VWD Express from the MS site, and this gave me a free download of a book called "Build A Web Site Now!", which is a (very light) introduction to VWD. In the...
1
by: needin4mation | last post by:
Hi, I have a metatag description like (this is in my masterpage) <meta name="description" id="MyMETADesc".... but this *inline* code fails: (this is in a contentpage based upon the master)...
7
by: xkeops | last post by:
Thinking of creating a website, most of the pages will have a general toolbar menu, a content and a footer. The content will be the only one who's gonna change but the rest (header,footer) will...
1
by: Asif | last post by:
Hi All, I did follow the MSDN article (http://msdn2.microsoft.com/en-us/ library/ms379585(VS.80).aspx ) for overriding Master Page properties by setting page title and other Meta information(...
2
by: Keith G Hicks | last post by:
I have a pretty small project right now that I just started last week. I have one master page and several content pages based on that master. I had originally neglected to set up the master with...
5
by: Murray | last post by:
Forgive me if this question is too basic, but I'm new to ASP.NET programming, and I can't locate a simple answer to this question. I have a web page that consists of a Master Page and a single...
10
by: _Who | last post by:
Seems to me that I should be able to do something like: ....runat="server" change from white.css to black.css... Of course if I could have found out how, I wouldn't be bothering you. Is...
0
by: cleary1981 | last post by:
Hi, Heres my xsl stylesheet. Its work in progress but it works. What I want to do however is to make one page in the middle (drawings) a landscape page. Can anyone explain how to do this as all...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.