Writing a META tag?

R

Rob Meade

Hi all,

I have the need to write a meta tag to the page BEFORE it loads...

My page does 3 things based on whats passed through in the query string:

1. Receive a file id and check its valid, display "Retrieving file...please
wait.", redirect to same page with altered querystring
2. Based on new querystring value retrieve document details and check its ok
to allow the user to download the file,, display a message to the user
depending on outcome of check either "sorry" and then nothing else happens,
or "Document ready to download" - redirect to same page with altered
querystring
3. Based on new querystring value, transfer file via SA-FileUp..

I did this in old ASP, each "page" was in between the if...then's etc, and
each "page" could have its own "meta refresh" if needed, 2 of them do, one
doesn't....

Now I'm trying to recreate this in a dot net page, I have panels for the
relevant sections, they get turned on/off depending on the
querystring/checks etc, but the meta refresh is a problem as if I add it to
the page in the HTML its therefore all 3 steps and the last one will keep
redirecting, so I need to be able to programmatically write this:

<meta http-equiv="refresh" content="--my duration, page and querstring
would be in here--">

to 2 of my steps based on the querstring values etc...and not on the
last...I managed to do this with a javascript function being called (or not)
with onLoad="" in the html being written based on criteria by setting the
body tag to runat="server" and then adding/removing an attribute but I
cannot do this for the meta tag...

I'm guessing these need to be written before the page renders? But have no
idea how to go about it...

Any help would be appreciated.

Regards

Rob
 
V

vMike

Rob Meade said:
Hi all,

I have the need to write a meta tag to the page BEFORE it loads...
This is how I handle custom metatags. I place a control in between the head
tags. The control contains a placeholder (say it's id is plc1). Then I use
the following type of code to put the meta tag items in the control.

strMetaTag = some_literal_metatag_text
plc1.controls.clear
plc1.controls.add(New Literalcontrol(strMetaTag)

Alternatively, if the tags can be standardized, you could create a control
that contain only metatags and add them to the placeholder.

plc1.controls.clear
dim ctl as control = loadcontrol("/yourmetatag1.ascx")
plc1.controls.add(ctl)

Mike
 
R

Rob Meade

...
This is how I handle custom metatags. I place a control in between the
head
tags. The control contains a placeholder (say it's id is plc1). Then I use
the following type of code to put the meta tag items in the control.

strMetaTag = some_literal_metatag_text
plc1.controls.clear
plc1.controls.add(New Literalcontrol(strMetaTag)

Alternatively, if the tags can be standardized, you could create a control
that contain only metatags and add them to the placeholder.

plc1.controls.clear
dim ctl as control = loadcontrol("/yourmetatag1.ascx")
plc1.controls.add(ctl)

Hi Mike,

Many thanks for the reply - I plonled a literal in there in the end and then
wrote to that on the page load in the code behind, seemed to work -
marvellous - thanks again for the reply.

Regards

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top