Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RenderExtraHeadElements in mobile apps

Status
Not open for further replies.

InShadows

IS-IT--Management
Jul 7, 2000
36
US
I am having difficulty adding a meta tag to this mobile application. At first I tried to just add it to the HTML. Of course that didn't work. Then I tried to do a response.addheader to the page and that failed miserably. Apparently, the only way to add meta information to the page is through an object called HTMLFormAdapter. There is a member there called RenderExtraHeadElements. I am trying to build an overrides function for it which will write the text but to no avail. Below is the code I have for it so far:

Imports System.Web.UI.MobileControls.Adapters

Public Class HtmlTimerFormAdapterVB
Inherits HtmlFormAdapter

Protected Overrides Function RenderExtraHeadElements(ByVal writer As HtmlMobileTextWriter) As Boolean
MyBase.RenderExtraHeadElements(writer)

If Not (writer Is Nothing) Then
writer.WriteBeginTag("meta")
writer.WriteAttribute("name", "robots")
writer.Write(" content=")
writer.Write(Chr(34))
writer.Write("noindex,nofollow")
writer.Write(Chr(34))
writer.WriteLine(">")
End If

RenderExtraHeadElements = True
End Function
End Class

This is in a class by itself, not the main code behind class, in a code behind page currently. Does it need to be called from the main code behind class? Should it be compiled as it's own DLL? What am I doing wrong? If someone has an easier solution to adding a meta tag to a mobile application besides using a robots.txt file that would be appreciated as well. Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top