I have got a code triggered from a jquery which does the following
<WebMethod(EnableSession:=True)>
<ScriptMethod()>
Public Shared Function SendData(ByVal data As Dictionary(Of String, Object)) As String
' Does some stuff
' Sending email
Return sArchivo & ".pdf"
End Function
The sending email just takes ages so I thought about doing this
<WebMethod(EnableSession:=True)>
<ScriptMethod()>
Public Shared Function SendData(ByVal data As Dictionary(Of String, Object)) As String
' Does some stuff
Dim sSendEmail As New Thread(Function() SendEmailTo(sArchivo & ".pdf", iGlobal_Em_Id, v3, v2))
sSendEmail.IsBackground = True
sSendEmail.Start()
Return sArchivo & ".pdf"
End Function
Which comes up with the "Cannot refer to an instance member of a class from within a shared method" error.
Removing the shared doesn't work as by doing so the method is not triggered by ajax anymore. What should I do ?