我希望使用以下程序在模块中设置我的网页的标题,关键字等。
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
问题是我得到两个错误。
在Me.Master
我收到'Me' is valid only within an instance method.
错误,并在
If Request...
我收到了错误
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.
那么我该如何解决这些问题呢?我希望将这个程序放在一个共同的地方而不是每一页。
提前谢谢。