There are a lot of different two pair situations. In some it's clearly not worth it to stack off, in another it's a standard move.
If you have a limped pot, you're OOP and flop top two on relatively dry board, bet/fold is usually the best play. It all depends on the board of course. If it has some draws and you get called and turn is blank, its pretty safe to bet again and fire blank river.
If, in limped pot, you're IP and flop top two and get checked to you, betting out is a no brainer. However, if a guy in front bets out - it depends. If he bets lets say half or 2/3rd pot into a board that has 2 cards of the same suit - it's usually a flush draw or a straight draw. Raising and calling are both good I guess. Of course you have to give up if flush or straight comes. If he bets pot - I prefer a fold if no draws come along with my two pair. Fold is safer here because I don't want to call pot bets on all streets with just two pair which will hardly ever improve.
In raised pot, two pair is usually nice, but again, it depends alot. Lets say you have AK76 rainbow and flop is 567 two hearts. If opponent bets pot or raises you - obviously you have to fold. There are a lot of different situations, but the main idea is not to go broke with them without redraws.
In general, it's hard to clearly outline the standard two pair play because it's very board, opponent and situation dependant. Safest way is to fold them because clearly two pair is not what you should be looking to flop, so you can think of them as missed flop