Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Next Newbie Web Service Question
Message
From
23/07/2007 18:22:07
 
General information
Forum:
ASP.NET
Category:
Web Services
Miscellaneous
Thread ID:
01242514
Message ID:
01243007
Views:
37
>What about having the login method return a login object, which is then passed to all other
>methods? It could have the GUID and any other info needed on it.


I don't recommend passing complex objects in Web Service methods. Not everyone agrees with that recommendation, but there are also plenty that do.

~~Bonnie


>
>
>
>
>>>I'm was hoping to wrap all my other WS methods in a check to see if the user is logged in.
>>>
>>>Since the WS is stateless, it seems that the only other thing I can do is pass the user name
>>>& password to each method.

>>
>>Well, I'd handle it a little differently than that. When a user logs in, we get a GUID from the user's profile in the database and pass that to all the other web methods. You could also pass a key instead if you prefer.
>>
>>~~Bonnie
>>
>>
>>
>>
>>>
>>>
>>>
>>>
>>>>Kevin G ... Statics in a Web Service class? Um, nope, not a good idea. You need to get off those sinus meds. <g>
>>>>
>>>>Kevin M ... Web Services are just like any other "web" stuff in that they are stateless. You can't set a variable and expect it to stay that way the next time you check. You're already returning the bool from the call to the Login() Web Method. You need to keep track of that some other way in your UI (and pass that bool around to subsequent Web Method calls if you need to).
>>>>
>>>>~~Bonnie
>>>>
>>>>
>>>>>Hey, Kevin,
>>>>>
>>>>>My head is a little whoozy from sinus meds, but I'll take a crack at this - you haven't created a property, you've only created a member variable. Depending on how you're instantiating your web service, that variable is going to be reset every time. Not sure how you're calling the function and how you've got this all set up, but you may need to create that variable as a true property and maybe even make it static. Anyway, that's probably the reason it's being set back to false. If that doesn't help, let me know. (maybe you can also post the code that's calling the web service)
>>>>>
>>>>>Kevin
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform