Server-Side Template Switching Causes a 404 Error (302199)



The information in this article applies to:

  • Microsoft Content Management Server 2001, when used with:
    • the operating system: Microsoft Windows 2000
  • NCompass Resolution 4.0, when used with:
    • the operating system: Microsoft Windows 2000

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 "404 - File not found" 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("template")
'Response.Write strTemplate
If strTemplate = "B" Then
strURL = Autosession.URLUsingAlternateTemplate("TestB")

'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 "/shared/ASPUtils.inc")

' 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

%>
				

REFERENCES

For additional information on how Response.Redirect can affect template switching in Windows 2000, click the article number below to view the article in the Microsoft Knowledge Base:

302198 Response.Redirect Can Affect Template Switching in Windows 2000


Modification Type:MajorLast Reviewed:11/17/2003
Keywords:kbprb KB302199