I have a query regarding the public shared method, I have an error that indicates BC30369: Cannot refer to an instance member of a class from a shared method.
I have the error in:
strUsuarioapp = ucase (user.identity.Name.split ("\") (0))
exactly in user
at the line ucase(user.identity.Name.split ("\") (0))
returns the data I need (domain user), I tried with another ucase(system.environment.usernane)
, but depending on the environment it gives me different values, while user.identity.Name
does not fail me.
I understand the error reference but I don't know how to pass the value, it is mandatory that the method be shared.
I can't remove the shared from the method, is there any code to pass the value of user.identity.Name
to it without giving me an error? code:
public class frmview1
inherits system.web.ui.page
public pstruserApp as string
public property strUsuarioapp () as string
get
return pstruserapp
end get
set (value as string)
pstrUsuarioapp = value
end set
end property
public shared function usercall (byval name as string, byval namev as string) as string
dim strUsuarioapp = ucase (user.identity.Name.split ("\") (0))
' Error here
' ....
' ....
return strresult
end function