The present invention provides aqueous formulations containing an anti-infection agent, a biocompatible polysaccharide, an osmotic pressure regulator, a pH regulator, and water, wherein a gel containing the therapeutic agent is formed in situ upon instillation of the formulations onto the skin and a body cavity of a subject. The formulations of this invention are useful for treating infectious diseases of skin or a body cavity (e.g., eye, nose, or vagina) of a subject.