SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to check SPWeb reference if it is a search site. How can i do this by code.

Thank you

share|improve this question
up vote 0 down vote accepted

If myWeb.Template property is one the following, this is a search site :

  • BLANKINTERNETCONTAINER (actually, it contains a subweb that can do search)

FYI, this list is computed by using this Powershell command :

Get-SPWebTemplate | ? { $_.description -match "search"}

You have to take into consideration that a "search" site is only a web site where the related web parts are put on pages. A search site can be customized to remove the search, and an another kind of web can add the web parts to be able to search

share|improve this answer
 site.WebTemplate == "SRCHCENTERLITE" ||
 site.WebTemplate == "SRCHCEN" ||
 site.WebTemplate == "SRCHCENTERFAST"

Where site is a SPWeb should get you all the OOTB search templates (as a conditional of course). I used this code in a site branding project to set my custom search master page instead of the other custom master page.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.