The regular Sunnah is to perform

Q 7: is offering Tahiyyat-ul-Masjid (two-unit Prayer to salute the mosque) after `Asr (Afternoon) and Fajr (Dawn) Prayers, (Part No. 7; Page No. 277) permissible in any Masjid (mosque), or only in Al-Haramayn Al-Sharifayn (the Two Sacred Mosques), or prohibited at that time in all the Masjids including Al-Haramayn Al-Sharifayn?

A: According to the preponderant view of scholars, upon entering the Masjid, a Muslim should offer Tahiyyat-ul-Masjid whether during the time of disapproval or not; in the three Masjids (the Sacred Mosque in Makkah, the Prophet's Mosque in Madinah, and Al-Aqsa Mosque in Jerusalem) or not. This is because of the general application of the following Hadith, When anyone among you enters the Masjid, he should not sit until he observes two Rak`ahs. As for the Hadith prohibiting Salah at the times of sunrise and sunset, and after `Asr and during the sunset, they are applicable to the absolute supererogatory Salah that have no specific reason, not for the obligatory ones and those with specific reasons like Tahiyyat-ul-Masjid and Al-Tawaf Prayer (two Rak`ahs done after circumambulating the Ka`bah). So, it is permissible to do these at all times including times when prayer is generally disallowed, after Fajr and after `Asr and in all the Masjids.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.