I've read this similar question but it doesn't quite satisfy me.
I have two use cases.
- An anonymous(unauthenticated) user tries to access a protected(authorized only) resource
- An authenticated user tries to access a resource which he is not entitled to access(ie, doesn't belong to a group)
For these two cases, which error code should be returned? I'm guessing 401 for the first and 403 for the second. But for 401, a WWW-Authenticate header must be included in the response. I'm not wanting to use the basic HTTP authentication, opting instead for the more conventional form based approach. (ie, user submits a form from Login.aspx or whatever).
So which one should I use?