Female Science Professor in The Chronicle: Can Well-Behaved Women Make (Academic) History?:
... [In responding to sexist slights] my tendency [is] to react in a calm, polite way, perhaps with a bit of humor or gentle sarcasm. Except in extreme cases, I prefer not to respond to insulting remarks with anger, and I try to move on with the research, teaching, or service task at hand.
It is important to note that I do not let every offensive remark pass without comment. For example, if I am serving on a hiring or awards committee, I speak up when I hear colleagues make derogatory or unfair comments about female (or any) candidates. The comments I tend to ignore are the ones directed at me, when I have to make a choice about how to respond in the context of my work environment.
My choice to react calmly and politely stems from several sources, including my personality (I dislike confrontation and argument) and my belief that this approach has been effective for me over the years.
This response from a law prof is seems appropriate: "... if you are regularly subjected to comments like the one you described ('You are only here because we needed a woman on the committee"), as well as the denigrating remarks you have heard directed at other women, then your department - and perhaps your college or university - has a legal problem that is waiting to blow up."