The first thing every photographer should keep in mind when photographing a religious building is to fully respect the sacred function of the temple and not causing offence while worshippers are praying. A bad behavior held inside a religious building, like a church, a mosque or a buddhist temple, just for shooting photos, is morally unacceptable and it can even put yourself in danger in several countries.
Always respect a sign telling you not to take photos at the entrance of a religious building. Also, if taking photographs is allowed try always to be sensitive when intruding on worshippers. Before shooting any photo of worshippers while praying always try to be nice and not intrusive. Try to show respect and appreciation about their religion so that maybe they will not mind if you taking photos. Anyway, don’t forget that worshippers may not want to be photographed. If so, do not insist and respect their will. When photographing a religious building learn to take it easy and watch around the temple you are visiting. You can sit down and watch worshippers coming to pray and going. Relax and wait in order to shoot the mystical atmosphere of the religious building. Don’t use flash if shooting inside the building as it is quite intrusive for the worshippers and useless in terms of quality of image. Remember to use tripod only if it is allowed!
Last but not least, always read and learn about the religious and historical background of the temple or building you are visiting and photographing so that you behave properly. For example, remember to never point your feet at Buddha image or sculpture.