This project is read-only.

Handling 404 errors in dasblog

Topics: Developer Thread, Resolved, Support Request
Mar 1, 2009 at 4:52 PM
I have changed the customErrors mode to On and set a redirect page for statusCode 404 in web.config, but it fails to work, I wonder if  dasblog has a way of handling this and how to do it?
Mar 8, 2009 at 8:59 AM
Would some one help to share some advice? I think that it may be related to URL mapping but can't figure out how to work out a solution
Mar 8, 2009 at 7:35 PM
Edited Mar 8, 2009 at 7:38 PM
OK here is what you need.

First the customErrors mode in the webconfig is for errors not "page not found" 404s.

You will need to customize your IIS custom error linkage 404 to point to "/error.aspx", which is part of daBlog 2.2 and above thanks to Alex Groß.

Now a page not found will call the default error page, which is a blank content theme page until you add a custom error theme.

So next you take your current theme directory and make a copy of it to a subdirectory directly under your current theme and name it error, for example "dasBlog/error"

Then you go to the subdirectory theme error and edit the manifest file to be named "error".

Something like this: <theme name="error" title="TomWatts" templateDirectory="themes/tw/error" imageDirectory="themes/tw/error">

Then edit the file "homeTemplate.blogtemplate" to display the text you want when a person gets a 404.

Somthing like this works in the place of  the <%bodytext%> macro.

<P><STRONG>Sorry, but the page you were looking for could not be found. See below for what you can do about that.</STRONG></P>
<H2>Your Options</H2>
<LI>Go to <A title="Go to the blog" href="">
<FONT color=#006400>the blog</FONT>
<LI>Search the blog archives ?
<LI>Read the latest blog posts ?</LI></OL></DIV>

You can see this in action at