You can try the 3m spray adhesive, it works as well as anything, but you're doomed in reality. The foam degrades/rots, there's no way to keep it up there permanently, once it starts to come down, it's a slippery slope. Start saving for a new headliner now!!
I had the best results with contact cement on the four headliners that I've done.
The best way (but the biggest pain in the ass) is to pull the roof cap off and turn it over while you're doing it. Especially if you're installing a whole new headliner. Otherwise gravity will be working against you the entire way.
i did the cheapo style and bought the carpet from auto parts store and got some vinyl floor glue from home depot and stuck it to the roof. it turned out 10x better than i thought. have gotten lots of compliments
Another idea for you...I had the roof all apart anyway for resto on the gutter and all so I stripped it all clean, wiped it down good with same cleaner used before painting, some ppg stuff I can't remeber the name of. Spray glued in a layer of heavy duty aluminum foil, trimmed some ensolite military sleeping pads to fit snug and nice and topped it with a nice looking polar fleece fabric that was on the close out table. Really quieted the interior and keeps the heat/cold out good also. Spray adhesive only works if all is clean and degreased.