IIS - Page Not Found - Asked By Kapil Desai on 01-Dec-11 06:11 AM

I am setting Error Pages

 <httpErrors>
    <remove statusCode="404" subStatusCode="-1" />
    <error statusCode="404" prefixLanguageFilePath="" path="/PageNotFound.aspx" responseMode="ExecuteURL" />
    </httpErrors>


and

 <customErrors  mode="On" >
    <error statusCode="404" redirect="/PageNotFound.aspx"/>
    </customErrors>

but the thing is.....It works on only root level of my website and not when folders inside the root are accessed with some junk page names , when multiple websites or applications are hosted on IIS 7.
But When i am using this settings on IIS 5.1, it works for both scenarios.


Ne help will be appreciated....:)
dipa ahuja replied to Kapil Desai on 01-Dec-11 06:25 AM
Give the path as "~/PageNotFound"

or you can put the error pages inside the folder like "ErrorPages"

and give the path as "ErrorPages/PageNotFound.aspx"
Kapil Desai replied to dipa ahuja on 01-Dec-11 06:59 AM
It doesn't work when i try to put non-existing page names inside sub-folders of my website....
it will work when i write
www.mysite.com/asdhaskjdaskd


but it wont work when
www.mysite.com/folder/kjahsdjashkasd