I have a Web Application which has Global_Asax and a Custom Error Page. When user tries to enter to an invalid page which doesn’t exist, Application_Error is fired in Global_asax and exception is logged which isn’t really an exception (You can see the exception details below). I don’t want to handle this case in global_asax but rather in IIS. I’ve also tried to enter invalid paths ending with .asp and .html and they work fine(They don’t end in global_asax but rather in default 404 page).
I need to know which setting I have to change from IIS7 Manager.
Any help would be appreciated.
Error – The file ‘/restricted/ff.aspx’
does not exist.System.Web.HttpException: The file
‘test.aspx’ does not exist. at
System.Web.UI.Util.CheckVirtualFileExists(VirtualPath
virtualPath) at
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath
virtualPath, Boolean noBuild, Boolean
allowCrossApp, Boolean
allowBuildInPrecompile) at
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext
context, VirtualPath virtualPath,
Boolean noBuild, Boolean
allowCrossApp, Boolean
allowBuildInPrecompile) at
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath
virtualPath, HttpContext context,
Boolean allowCrossApp, Boolean
noAssert) at
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath
virtualPath, Type requiredBaseType,
HttpContext context, Boolean
allowCrossApp, Boolean noAssert) at
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext
context, String requestType,
VirtualPath virtualPath, String
physicalPath) at
System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at
System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously)
You can try one of these:
Edit the web.config file for custom errors:
Add a
404.aspxpage and set the status code to 404:If it doesn’t help you try this as well (it might be reset by your masterpage):