This guide shows you how to handle page not found (404) errors in Content Studio and how to configure a custom page that displays an error message. Handling 404 errors on a Content Studio site requires editing settings in both Content Studio and Internet Information Services (IIS).

Configuring Content Studio

  1. Log in to Content Studio admin.
  2. Create a New Category.
    For example: in Admin/Moduler create category Custom errors.
  3. Right click -> New Document. This page will be displayed when 404 error occurs.
  4. Right click the newly created category (Custom errors), check use start document and set the id of the new document in the box.
  5. Next CS is configured to redirect to the created document if 404 occures, however this only applies to aspx pages (Next section covers setting up IIS to handle directories and other file types)
    Right click the site root, click properties. Under advanced settings and actions, click settings.
  6. Find site.DocNotFoundId. Click Edit and enter the id of the newly created document. Click Save.

    Setting doc not found id 

Configuring IIS

  1. Go to Control Panel/Administration tools/.
    Open Internet Information Services (IIS6) Manager.
  2. Right click appropriate web site (under web sites), click properties.
  3. Click the Custom Errors tab, locate HTTP error 404 and click Edit.
    Enter path to the category created in the previous section.
    Example: /Admin/Moduler/Custom errors

    Setting doc not found id

404 errors will now be redirected to /Admin/Moduler/Custom errors, which in turn will redirect to the above specified document id. IIS passes the requested url - that was not accessible - in an empty querystring so that it can be read in code.

A request to

is redirected to

Reading the empty querystring results in:

The following example reads the empty querystring and prints an error message.

	string url = Request.QueryString[""];
	Label1.Text = "The page you requested is not accessible: " + url.Split(';')[1];
	Label1.Text = "";
	Dim url as string = Request.QueryString("")
	Label1.Text = "The page you requested is not accessible: " & url.Split(";"c)(1)
	Label1.Text = ""
End Try

This was a very simple example, of course one could think of more advanced applications, for example performing a filter query against an EPT category - searching for the string entered after / and redirecting if anything is found.