I want to know how do you detect if a user belong to a particular domain. I have a group of user in a text file. I will read them and then group them to their respectly domain.

How can I do that.
Provide sample codes if possible.

Thanks