Reputation: 3057
I was following this tutorial he described username and password validator for wcf service . Now i stuck in between becuase username and password is hardcoded . I have multiple users going to consume my service then how can i hardcode each and every one . And also i don't want to check username password from database because it would be a overhead for service . Is this possible to authenticate user when he comes first time and then as long as his session exists he doesn't need to go for database ?
Upvotes: 1
Views: 113
Reputation: 6030
Personally I'd avoid sessions. The Overhead for a Task like that isn't that big anyway. It's a simple check in a database.
But to avoid that you could add some Kind of User repository to your Service, so that doesn't have to contact the DB for every Single request.
Another Approach could be to issue an auth Cookie once a User successfully logs in. (search for .ASPXAUTH
cookie for a reference)
Upvotes: 3