You could just use regular 3M Scotch tape to secure it to the wall.
However, instead of running an ethernet cable through a doorway, why not get
Powerline Ethernet. I know that the model I listed is rather pricey... There are more budget friendly ones out there.
Basically, Powerline Ethernet transmits an ethernet signal through the wiring of your house. It's completely safe and adds no risk of a fire hazard. One unit needs to be in reach of a device to connect to via an ethernet cable. Once that's taken care of, plug the other unit in near the computer that needs an ethernet connection and run a cable from the unit to the computer. No more ethernet through doorways!
Tip: The two units don't have to be on the same circuit, just as long as power is coming from the same outside source.