0
我希望使用以下過程在模塊中設置頁面的標題,關鍵字等。從模塊調用共享過程
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.
那麼如何解決這些?我希望在一個共同的地方,而不是在每一頁都有這個程序。
預先感謝您。