Microsoft KB Archive/887530

= The Searches.GetByUrl method does not retrieve the correct URL after you enable the &quot;Map Channel Names to Host Header Names&quot; option in Content Management Server 2002 =

Article ID: 887530

Article Last Modified on 7/5/2005

-

APPLIES TO


 * Microsoft Content Management Server 2002

-





SYMPTOMS
When you enable the Map Channel Names to Host Header Names option in the Microsoft Content Management Server 2002 Server Configuration Application, and you are using the Searches.GetByUrl method in your template project to retrieve link information for a specific channel, you may notice that the link to that channel may no longer work correctly.

When this behavior occurs, the Searches.GetByUrl method does not retrieve the correct URL.



WORKAROUND
To work around this problem, add the following Microsoft Visual C# script to the module that is configured with the Searches.GetByUrl method.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. private bool MapChannelToHostHeaderEnabled(CmsContext ctx) { return (ctx.RootChannel.UrlModePublished == &quot;http://Channels/&quot;); }

private ChannelItem EnhancedGetByUrl(CmsContext ctx, string Url) { if (MapChannelToHostHeaderEnabled(ctx)) { string Path = HttpUtility.UrlDecode(Url); Path = Path.Replace(&quot;http://&quot;,&quot;/Channels/&quot;); if (!Path.StartsWith(&quot;/Channels/&quot;)) Path = &quot;/Channels/&quot;+HttpContext.Current.Request.Url.Host+Path; if (Path.EndsWith(&quot;.htm&quot;)); Path = Path.Substring(0,Path.Length-4); if (Path.EndsWith(&quot;/&quot;)) Path = Path.Substring(0,Path.Length-1); return (ChannelItem)(ctx.Searches.GetByPath(Path)); } else return ctx.Searches.GetByUrl(Url); }



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

Keywords: kbtshoot kbprb KB887530

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.