I was pushed to replace the default search box in a site collection with a customized one. At the moment it looks like this:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" ControlAssembly="Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<!--Advanced Search Link-->
<Property Name="ShowAdvancedSearch">true</Property>
<Property Name="AdvancedSearchPageURL">_layouts/xyz/SupplierPhonebook/AdvancedSearch.aspx</Property>
<!--Search Options-->
<Property Name="SearchResultPageURL">_layouts/xyz/SupplierPhonebook/AdvancedSearch.aspx</Property>
<Property Name="QueryPromptString">Nach Ansprechpartner suchen...</Property>
<Property Name="UseSiteDefaults">true</Property>
<Property Name="ScopeDisplayGroupName"></Property>
<!--Layout Options-->
<Property Name="SearchBoxTableClass">search-box</Property>
<Property Name="GoImageUrl">/_layouts/images/gosearch15.png</Property>
<Property Name="GoImageUrlRTL">/_layouts/images/gosearchrtl15.png</Property>
<Property Name="GoImageActiveUrl">/_layouts/images/gosearchhover15.png</Property>
<Property Name="GoImageActiveUrlRTL">/_layouts/images/gosearchrtlhover15.png</Property>
<Property Name="DropDownMode">HideScopeDD</Property>
<Property Name="FrameType">None</Property>

By default it works, but only at the default page of the site collection. So when I first enter a other page, list, application page etc. pp the link is wrong.

Than it looks like this:


or like this when I'm performing a search


I have tried mostly all url tokens (~Site, ~SiteCollection, ~site.. etc.) Nothing works. I can't implement a fixed url cause the application will be tested on serveral servers with different urls.

So what I need is to know how I could redirect the AdvancedSearchPageURL and SearchResultPageURL allways to a page like this: http://{SERVER}:{PORT}/{SITECOLLECTION}/_layouts/xyz/SupplierPhonebook/AdvancedSearch.aspx

The problem with the url tokens is, that they dont get translated :\

Thx alot

Best Regards



I think those URL's have to be sitecollection relative. So if _layouts or /_layouts does not give the right result, I would try the following...

If you set the 'UseSiteDefaults' property of SearchBoxEx control to 'True' it will then take the configured values of the site. Site Actions > Site Settings > Search Settings. Maybe that will make a difference.

The following method will work 100%: if you inherit from the SearchBoxEx control - you can set the this.AdvancedSearchPageURL = SPContext.Current.Site.Url + "/_layouts....";

Hope that helps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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