Pipe flanges are protected from corrosion by means of electrolysis,with dielectric flanges. The piping system is electricaly insulated by what is called a sacrificial anode. A bag of readily corrodable metal is buried in the ground with a wire running from the pipe to the bag so that the sacrificial anode will corrode first. If any electrical current charges the pipe it also serves as a ground.
Tieger