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.
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.