18 Jul 2012
24 Apr 2008
Link to this post
thank you for your helpful reply. I'm sorry about not being clear on what I'm trying to accomplish. so let me try again:
okay, so I want people to be able to access pages from the folder, not just by typing in the full link. For example, if users want to go to site.com/departments/default.aspx, I would like for them to be able to just type site.com/departments or site.com/departments/. obviously since these pages do not really physically exist (because of the url rewriting), if a user types in these shortcut addresses, they will get a 404 error.
so according to the documentation, the way to handle this is to pass the 404 error handling to sitefinity's sf404.aspx page. I went into IIS and mapped the 404 error message to redirect to ~/sf404.aspx and now, if I type in site.com/departments I do indeed get redirected to site.com/departments/default.aspx. PERFECT! it's just what I wanted!
but, what if the user misspells departments, and instead enters site.com/deparmtents? this of course also results in a 404, which is also sent to the ~/sf404.aspx. when this page does it's magic work to find the correct page, it's not going to find it because it doesn't exist anywhere. so I want to be able to THEN show a standard 404 page error message telling the user their request could not be found.
Now, I tried setting the customErrors in the web.config to redirect to my own ~/404.aspx page on statuscode 404. And if I do that it works! missing pages redirect to that page just great! but then, if I try doing the site.com/departments again, I get "Server Error Application" that the physical path "C:\inetpub\sitefinity\departments" doesn't exist!
so it looks like I can either have the sf404.aspx page to catch 404s and try to find the right page, and if not throw an unfriendly error. OR I can turn on custom errors and catch all 404 errors, but then I lose the ability to map to extensionless pages like site.com/departments.
is there a way to get both?