I am using VS 2005 and .net 2.0. I have this code:
Public Class MenuSystem
Inherits System.Web.UI.Page
Public Shared strPath As String
Public Shared strServerURL As String
Public Shared Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
strServerURL = Request.Url.ToString
If strServerURL = "someURL" Then
strPath = "../somefilepath.aspx"
Else
strPath = "someOtherfilepath.aspx"
End If
End Sub
End Class
I am receiving this error when I mouse over Request in VS - 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.
I have read on Microsoft's website that - you have referenced a non-shared member within your code and failed to supply an object reference. You cannot use the class name itself to qualify a member that is not shared. The instance must first be declared as an object variable and then referenced by the variable name.
Didn't I already do that by delcaring strServerURL? Any help would be greatly appreciated.
Public Class MenuSystem
Inherits System.Web.UI.Page
Public Shared strPath As String
Public Shared strServerURL As String
Public Shared Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
strServerURL = Request.Url.ToString
If strServerURL = "someURL" Then
strPath = "../somefilepath.aspx"
Else
strPath = "someOtherfilepath.aspx"
End If
End Sub
End Class
I am receiving this error when I mouse over Request in VS - 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.
I have read on Microsoft's website that - you have referenced a non-shared member within your code and failed to supply an object reference. You cannot use the class name itself to qualify a member that is not shared. The instance must first be declared as an object variable and then referenced by the variable name.
Didn't I already do that by delcaring strServerURL? Any help would be greatly appreciated.