Microsoft KB Archive/302199

= Server-Side Template Switching Causes a 404 Error =

Article ID: 302199

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Content Management Server 2001 Enterprise Edition, when used with:
 * Microsoft Windows 2000 Standard Edition
 * NCompass Resolution 4.0, when used with:
 * Microsoft Windows 2000 Standard Edition

-



This article was previously published under Q302199



SYMPTOMS
When you use the URLUsingAlternateTemplate property and the Response.Redirect method on a Microsoft Windows 2000-based computer, you may receive the following error message when you browse to a URL:

HTTP 404 - File not found Internet Information Services



CAUSE
This problem is caused by a bug in Microsoft Internet Information Server (IIS) version 5.0. IIS 5.0 improperly encodes the URL and generates a &quot;404 - File not found&quot; error.



RESOLUTION
To resolve this problem, use the ASPUtils.Redirect function instead of the URLUsingAlternateTemplate property to effectively simulate an IIS 4.0 server-side Reponse.Redirect method by using the following method:

NOTE: This method is located in a file named Asputils.inc on the Content Management Server (CMS) 2001 server. <% Dim strTemplate, strRedirectURL strTemplate = Request.Querystring(&quot;template&quot;) 'Response.Write strTemplate If strTemplate = &quot;B&quot; Then strURL = Autosession.URLUsingAlternateTemplate(&quot;TestB&quot;)

'According to the documentation, you should be able to use the following: 'Response.Redirect( strRedirectURL ) 'However, if you are running Windows 2000, this may not work, and 'you have to use the following: (function from &quot;/shared/ASPUtils.inc&quot;)

' Redirect special for Windows 2000 ' Does a server side redirect. Calls ASPUtils redirect method (not ' response.redirect). This function can be changed to take out the ' reliance on the ASPUtils object. Sub ServerSideRedirect( strRedirectURL ) 'Get a copy of the ASPUtils object. Dim pASPUtils Set pASPUtils = GetInitializedASPUtils

'Call the ASPUtils method with the passed-in URL as the redirect address. pASPUtils.Redirect( strRedirectURL ) End Sub

ServerSideRedirect(strRedirectURL) End If

%>

