Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Trouble with session

Thread Tools

Trouble with session

Posts: n/a
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")
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?


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Timeout problems-web.confg session state and IIS session s =?Utf-8?B?Um9iSEs=?= ASP .Net 4 04-11-2007 04:52 PM
i have no trouble to send , ihave trouble reciving mail --any ideas John Penney Computer Support 4 08-29-2006 08:45 PM
Session State - What does it take to establish one single ASP.NET session per "browser session" Jeff Smythe ASP .Net 3 01-02-2004 04:10 AM
How can I "know" the difference between a session timed out and a session that did session.abort? Jazzis ASP General 2 09-23-2003 07:16 AM
trouble with caching or caching the trouble Hypo ASP .Net 6 08-01-2003 07:11 AM