Hi, I've tried this with an aspx error page and also a .html error page, unfortunately in neither case does it make a difference. I did notice that with this section added a request for nopage.html (this page does not exist) would cause the same error, however
if the section above is not in the web.config the same request would go to the standard error page set in the customErrors section.
You have to handle this error on gloable.asax file.
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
// Get last error from the server
Exception exc = Server.GetLastError();
if (exc is HttpUnhandledException)
{
if (exc.InnerException != null)
{
exc = new Exception(exc.InnerException.Message);
Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax",
true);
}
}
}
Using breack point on you will be able to find error type. there are no errror on your web config file
You have to handle this error on gloable.asax file.
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
// Get last error from the server
Exception exc = Server.GetLastError();
if (exc is HttpUnhandledException)
{
if (exc.InnerException != null)
{
exc = new Exception(exc.InnerException.Message);
Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax",
true);
}
}
}
Using breack point on you will be able to find error type. there are no errror on your web config file
Thank you for your assistance, the type of exception returned by Server.GetLastError is System.Web.HttpException with blank Message, null InnerException and the following stack trace -
at System.Web.CachedPathData.GetPhysicalPath(VirtualPath virtualPath)
at System.Web.CachedPathData.GetConfigPathData(String configPath)
at System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp)
at System.Web.HttpContext.GetFilePathData()
at System.Web.HttpContext.GetConfigurationPathData()
at System.Web.Configuration.RuntimeConfig.GetConfig(HttpContext context)
at System.Web.HttpContext.get_ImpersonationToken()
at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
at System.Web.ThreadContext.SetImpersonationContext()
at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean setImpersonationContext)
at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
If I then try a Server.Transfer to either my custom error.aspx or simply a blank html file I get another HttpException with the following details -
Message - "Error executing child request for 404.html." (404.html is my blank html file)
Stack trace -
at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at ASP.global_asax.Application_Error(Object sender, EventArgs e) in c:\Users\PAllen\Documents\Visual Studio 2005\WebSites\TicketTree\Global.asax:line 36
I really could do with some help with this, I'm pulling my hair out and it's costing me money as my website fails PCI/DSS tests with this error.
To repeat, the gist of the problem is as follows
MyDomain/unknownDirectory - This brings up the IIS default 404 error page
MyDomain/unknownFileWithExtension (eg MyDomain/file.htm) - This also brings up the default 404 error page
MyDomain/unknownFileWithDotButNoExtension (eg MyDomain/file.) - This beings up the following error -
Runtime ErrorDescription: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.
If I switch off custom errors the normal 404 page is displayed. There appears to be nothing within the custom error page to throw another exception (I have tried with a blank error aspx and html page).
Changing error.aspx for Error.aspx means that the website no longer displays the server error but instead a blank file.
Whilst this is still very odd, and not the correct behaviour, it does mean that the site passes the PCI/DSS certification so I'm happy to leave it as is.
PhilAllen
0 Points
10 Posts
Re: Problem with custom error pages
Jan 09, 2013 12:24 PM|LINK
Hi, I've tried this with an aspx error page and also a .html error page, unfortunately in neither case does it make a difference. I did notice that with this section added a request for nopage.html (this page does not exist) would cause the same error, however if the section above is not in the web.config the same request would go to the standard error page set in the customErrors section.
Sujeet Saste
Contributor
2998 Points
572 Posts
Re: Problem with custom error pages
Jan 10, 2013 02:58 AM|LINK
Hi PhilAllen,
Can you share your web.config code with us..
So we can provide better solution to your problem.
Do FEAR (Face Everything And Rise)
Please mark as Answer if my post helps you..!
My Blog
roshcha
Member
144 Points
31 Posts
Re: Problem with custom error pages
Jan 10, 2013 03:21 AM|LINK
Hi,
You have to handle this error on gloable.asax file.
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
// Get last error from the server
Exception exc = Server.GetLastError();
if (exc is HttpUnhandledException)
{
if (exc.InnerException != null)
{
exc = new Exception(exc.InnerException.Message);
Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax",
true);
}
}
}
Using breack point on you will be able to find error type. there are no errror on your web config file
http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/aspnet-error-handling
PhilAllen
0 Points
10 Posts
Re: Problem with custom error pages
Jan 10, 2013 11:27 AM|LINK
Hi Roshcha,
Thank you for your assistance, the type of exception returned by Server.GetLastError is System.Web.HttpException with blank Message, null InnerException and the following stack trace -
at System.Web.CachedPathData.GetPhysicalPath(VirtualPath virtualPath)
at System.Web.CachedPathData.GetConfigPathData(String configPath)
at System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp)
at System.Web.HttpContext.GetFilePathData()
at System.Web.HttpContext.GetConfigurationPathData()
at System.Web.Configuration.RuntimeConfig.GetConfig(HttpContext context)
at System.Web.HttpContext.get_ImpersonationToken()
at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
at System.Web.ThreadContext.SetImpersonationContext()
at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean setImpersonationContext)
at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
If I then try a Server.Transfer to either my custom error.aspx or simply a blank html file I get another HttpException with the following details -
Message - "Error executing child request for 404.html." (404.html is my blank html file)
Stack trace -
at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at ASP.global_asax.Application_Error(Object sender, EventArgs e) in c:\Users\PAllen\Documents\Visual Studio 2005\WebSites\TicketTree\Global.asax:line 36
Thanks again
Phil
PhilAllen
0 Points
10 Posts
Re: Problem with custom error pages
Jan 10, 2013 12:38 PM|LINK
Hi Sujeet,
Thanks for your assistance.
Here is our current web.config, it has been adapted with previous recommendations although they are not now shown.
Our website was hosted on a Windows 2000 server running .Net 2.0, it has moved to a Windows 2008 server and runs on .Net 4.0 now on IIS 7
I'm not sure if the problems were present before but are now occuring both on my development machine and live server.
<?xml version="1.0"?> <configuration> <configSections> <sectionGroup name="devExpress"> <section name="settings" type="DevExpress.Web.ASPxClasses.SettingsConfigurationSection, DevExpress.Web.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/> <section name="compression" type="DevExpress.Web.ASPxClasses.CompressionConfigurationSection, DevExpress.Web.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/> <section name="themes" type="DevExpress.Web.ASPxClasses.ThemesConfigurationSection, DevExpress.Web.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/> <section name="errors" type="DevExpress.Web.ASPxClasses.ErrorsConfigurationSection, DevExpress.Web.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/> </sectionGroup> </configSections> <connectionStrings> <add name="CONNECTIONSTRINGNAME" connectionString="Data Source=[SERVERNAMEHERE];Initial Catalog=[DBNAMEHERE];Integrated Security=True" providerName="System.Data.SqlClient"/> </connectionStrings> <system.web> <authentication mode="Forms"> <forms loginUrl="Admin/login.aspx" name="MyLogin"/> </authentication> <customErrors mode="On" defaultRedirect="~/error.aspx"> </customErrors> <compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="DevExpress.Web.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.Printing.v11.2.Core, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.Data.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.Web.ASPxHtmlEditor.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.Web.ASPxSpellChecker.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.Utils.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.XtraEditors.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.XtraCharts.v11.2.Web, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.XtraCharts.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="DevExpress.Charts.v11.2.Core, Version=11.2.14.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/> <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Web.RegularExpressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </assemblies> </compilation> <httpModules> <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/> </httpModules> <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> </system.web> <system.webServer> <modules> <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v11.2, Version=11.2.14.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/> </modules> </system.webServer> <location path="Admin"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> <location path="Affiliates"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> <location path="Affiliates/Service"> <system.web> <authorization> <deny users="*"/> </authorization> </system.web> </location> <devExpress> <settings rightToLeft="false"/> <compression enableHtmlCompression="false" enableCallbackCompression="true" enableResourceCompression="true" enableResourceMerging="false"/> <themes enableThemesAssembly="true"/> <errors callbackErrorRedirectUrl="~/error.aspx"/> </devExpress> </configuration>PhilAllen
0 Points
10 Posts
Re: Problem with custom error pages
Jan 11, 2013 07:15 PM|LINK
Hi guys,
I really could do with some help with this, I'm pulling my hair out and it's costing me money as my website fails PCI/DSS tests with this error.
To repeat, the gist of the problem is as follows
MyDomain/unknownDirectory - This brings up the IIS default 404 error page
MyDomain/unknownFileWithExtension (eg MyDomain/file.htm) - This also brings up the default 404 error page
MyDomain/unknownFileWithDotButNoExtension (eg MyDomain/file.) - This beings up the following error -
Runtime Error Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.
If I switch off custom errors the normal 404 page is displayed. There appears to be nothing within the custom error page to throw another exception (I have tried with a blank error aspx and html page).
Thanks again
Phil
Sujeet Saste
Contributor
2998 Points
572 Posts
Re: Problem with custom error pages
Jan 12, 2013 03:14 AM|LINK
Hi PhilAllen, try following :
or
It worked for me in my testing environment... Hope it helps..
I know you have tried same above, just give path like i specified and let me know.
Do FEAR (Face Everything And Rise)
Please mark as Answer if my post helps you..!
My Blog
PhilAllen
0 Points
10 Posts
Re: Problem with custom error pages
Jan 16, 2013 09:46 AM|LINK
Hi Surjeet,
Thank you for the advice.
It has fixed the problem, sort of...
Changing error.aspx for Error.aspx means that the website no longer displays the server error but instead a blank file.
Whilst this is still very odd, and not the correct behaviour, it does mean that the site passes the PCI/DSS certification so I'm happy to leave it as is.
Thanks again and kind regards
Phil