S
Shawn
Hi.
I have a webservice with a couple of methods. One of them is a login
function where I validate the user and send back a key (in the form of a
Guid). The user must then supply this key when he calls one of my other
methods so that I know that he has been validated. I'm trying to store this
key in session on the webservice, but I get an error.
Here is a simplified version of my code:
<WebMethod(EnableSession:=True)> Public Function Login(ByVal Username As
String, ByVal Password As String, ByVal Domain As Integer) As Guid
If Username = "xxx" And Password = "xxx" And Domain = 999 Then
Session("guidToken") = guid.NewGuid()
Return Session("guidToken")
Else
Throw New Security.SecurityException()
End If
End Function
<WebMethod(EnableSession:=True)> Public Function ReadXML(ByVal
guidLoginToken As Guid) As Byte()
'Check that the user is logged in.
If Not guidLoginToken.ToString = Session("guidToken").ToString Then
Throw New MethodAccessException()
End If
......
....
End Function
I'm getting the error when I call the ReadXML function. "Object reference
not set to an instance of an object". The error occurs at this line: "If
Not guidLoginToken.ToString = Session("guidToken").ToString Then"
Any ideas?
Thanks,
Shawn
I have a webservice with a couple of methods. One of them is a login
function where I validate the user and send back a key (in the form of a
Guid). The user must then supply this key when he calls one of my other
methods so that I know that he has been validated. I'm trying to store this
key in session on the webservice, but I get an error.
Here is a simplified version of my code:
<WebMethod(EnableSession:=True)> Public Function Login(ByVal Username As
String, ByVal Password As String, ByVal Domain As Integer) As Guid
If Username = "xxx" And Password = "xxx" And Domain = 999 Then
Session("guidToken") = guid.NewGuid()
Return Session("guidToken")
Else
Throw New Security.SecurityException()
End If
End Function
<WebMethod(EnableSession:=True)> Public Function ReadXML(ByVal
guidLoginToken As Guid) As Byte()
'Check that the user is logged in.
If Not guidLoginToken.ToString = Session("guidToken").ToString Then
Throw New MethodAccessException()
End If
......
....
End Function
I'm getting the error when I call the ReadXML function. "Object reference
not set to an instance of an object". The error occurs at this line: "If
Not guidLoginToken.ToString = Session("guidToken").ToString Then"
Any ideas?
Thanks,
Shawn