What is the best glue to use when you glue a metal soap dish to a tile in the bathroom.
My approach (depending on the mating surface available, shape, etc.) would be to use pure "clear" silicone along with a bit of foam tape.
Cut a small piece of foam tape to act as a temporary anchor while the silicone sets. Place it in the center of the soap dish back panel in a location that allows you to apply a bead of silicone entirely around it (to effectively seal it in).
Once the silicone is applied to the back of the dish, stick the dish to the wall and press firmly. Wipe any extra sealant from the wall and dish.
Optionally, once the silicone sets (2-4 hours should do), run a small bead around the dish to seal it further and improve appearance.
If the soap dish can't be secured by drilling holes for wall anchors here is a good choice for an adhesive: "Plumbers Goop", comes in clear or black. A very thick and when cured resilient waterproof adhesive. Once it dries it wont come off easily. Clean the tile surface with alcohol, first. You will have to temporarily tape the soap dish in place until full cure (about 24 hrs.).
Use silicone or Kerdi-Fix. Kerdi Fix is probably the better choice but it's expensive and can be hard to find. Silicone is probably 'good enough'.
You can use double-stick foam to hold it up as isherwood says, or a strip of tape as a strap to hold it up (as in this thread on JohnBridge.com
IMO silicone (or a silicone-based adhesive like Kerdi) is the best choice. Epoxy, JB Weld, etc. may work, but if they don't you have quite a mess to clean off your tile before you can try again. Silicone can be removed fairly easily with a razor blade and a dish scrubber, so if you make a mistake and your soap dish falls off you can easily try again.