I would love to use the following procedure to set the Title, keywords etc. of my pages, in a module.
Public Shared Sub SetTitle(ByVal Heading As String, ByVal Keywords As String())
Dim myMaster As Masterpage = DirectCast(Me.Master, Masterpage)
If Request.QueryString("lng") = "es" Then
myMaster.MasterHeading = Heading
myMaster.MetaTitle = Heading
myMaster.MetaDescription = ""
myMaster.MetaKeywords = GetKeywords(Keywords)
End If
myMaster.MetaTitle = myMaster.MasterHeading
End Sub
The problem is that i get two errors.
At Me.Master
i get the 'Me' is valid only within an instance method.
error and at
If Request...
i get the error
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
So how do i fix these? I would like to have that procedure in a common place and not in every page.
Thank you in advance.