I can determine the search center page for a site using:
site.OpenWeb().AllProperties["SRCH_ENH_FTR_URL"]
If I have multiple sites in a web application say site1 and site2. site1 has searchcenter page. site2 does not have one. But for site 2 if i put /SearchCenter/Pages for the search center. It uses the site1's search center.
However if i try site2.OpenWeb("/SearchCenter"). It throws an exception. Whereas site1.OPenWeb("/SearchCenter") works.
in order to open for site2 i did site2.WebApplication.Sites[0].OpenWeb("/SearchCenter").
But this seems a hack.
Is there a cleaner way to open searchcenter that a current site is using?
Thanks.