The Searches.GetByUrl method does not retrieve the correct URL after you enable the "Map Channel Names to Host Header Names" option in Content Management Server 2002 (887530)
The information in this article applies to:
- Microsoft Content Management Server 2002
SYMPTOMSWhen 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.WORKAROUNDTo 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 == "http://Channels/");
}
private ChannelItem EnhancedGetByUrl(CmsContext ctx, string Url)
{
if (MapChannelToHostHeaderEnabled(ctx))
{
string Path = HttpUtility.UrlDecode(Url);
Path = Path.Replace("http://","/Channels/");
if (!Path.StartsWith("/Channels/"))
Path = "/Channels/"+HttpContext.Current.Request.Url.Host+Path;
if (Path.EndsWith(".htm"));
Path = Path.Substring(0,Path.Length-4);
if (Path.EndsWith("/"))
Path = Path.Substring(0,Path.Length-1);
return (ChannelItem)(ctx.Searches.GetByPath(Path));
}
else
return ctx.Searches.GetByUrl(Url);
}
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Modification Type: | Major | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbtshoot kbprb KB887530 kbAudEndUser kbAudDeveloper |
---|
|