"What is your name again?" sounds very rude because it is demanding and makes no attempt to apologize for the rudeness of having forgotten someone's name.
It would be better to do as Mike suggests and add the apology as well as an explanation:
"I'm sorry, what's your name again? I didn't quite catch it the first time."
or
"I'm sorry, I'm bad with names, what was your name again?"
A good way to be polite when using the English language is to add modal verbs to your requests:
"I'm sorry, I have forgotten your name - COULD you tell me your name again?"
"WOULD you mind telling me your name again, I didn't quite catch it?"
"MAY I ask what your name is again? I didn't quite catch it the first time."