The inventors have developed a novel antifouling chemistry that is also chlorine-resistant. The coating derives from poly(4-vinylpyridine) (P4VP), which has been used as the precursor for antimicrobial coatings. P4VP is reacted with 1,3-propane sultone to obtain a zwitterionic chemistry with a balanced surface charge that minimizes the interaction with and thus attachment from various microbes. Divinylbenzene (DVB) copolymerizes with 4VP and renders the copolymer resistant to the oxidation of chlorine. The simultaneous use of chlorine (an extremely potent antimicrobial agent) and the chlorine-resistant, antifouling coating achieves much greater fouling resistance than that if one assumes additive effects between chlorine and the coating (namely synergistic effect). Ultrathin P4VP coatings are put down on commercially available TFC membranes via iCVD. Since surface tension and de-wetting are avoided, this all-dry process conforms to the geometry of the underlying substrate.