"Great Stuff" is rigid foam in a can. It will expand and cause distortion of closed spaces as it expands, but, given one wide-open surface, it will cure to form a fairly rigid mass. It adheres to almost anything that is clean and roughened to help it grip.
"Through The Roof" is a petroleum-solvent based product made for patching roofs. Sticks to anything, even tar on the roof. Fumes are terrible. Work in an area with good ventilation. It resembles "Shoe Goo", but costs a lot less per oz and dispenses easily from a caulking gun. A gooey liquid at first, it then gets rubbery, finally gets tough.