This is a ban on employers -- afaik, recruiters can still ask (and many probably will ask). But, IANAL. (Correction: It looks like recruiters fall under this prohibition too, if they are acting as agents of the employer.) I personally never answer questions about my previous salary or my expected salary. When HR has given me forms to fill out that have questions about either I just leave them blank, and they've never…
When asked about salary I say that I consider my previous/current employer's salary information to be proprietary & confidential information and I would be violating the agreement I signed when I joined that company to keep such information private, by revealing it.
I basically present it as an ethical issue, and effectively say, "I feel I would be doing something unethical by revealing that information. You're not going to ask me to do something I consider unethical, are you?"
Of course, if they say yes, that tells me something else entirely too, and also something I'd like to know before I start working somewhere.