diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/HttpError.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/HttpError.cs
index e46b2041..2b7ff7fc 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/HttpError.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/HttpError.cs
@@ -34,8 +34,25 @@ using System.ComponentModel;
namespace WebsitePanel.Providers.Web
{
- public class HttpError
+ public enum HttpErrorsMode
{
+ DetailedLocalOnly = 0,
+ Custom = 1,
+ Detailed = 2
+ }
+
+ public enum HttpErrorsExistingResponse
+ {
+ Auto = 0,
+ Replace = 1,
+ PassThrough = 2
+ }
+
+ public class HttpError
+ {
+ public const HttpErrorsMode DefaultHttpErrorsMode = HttpErrorsMode.DetailedLocalOnly;
+ public const HttpErrorsExistingResponse DefaultHttpErrorsExistingResponse = HttpErrorsExistingResponse.Auto;
+
private string errorCode;
private string errorSubcode;
private string handlerType;
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/WebVirtualDirectory.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/WebVirtualDirectory.cs
index 26bce3f7..f3e083b0 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/WebVirtualDirectory.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/WebVirtualDirectory.cs
@@ -61,6 +61,8 @@ namespace WebsitePanel.Providers.Web
private string defaultDocs;
private string httpRedirect;
private HttpError[] httpErrors;
+ private HttpErrorsMode errorMode;
+ private HttpErrorsExistingResponse existingResponse;
private MimeMap[] mimeMaps;
private HttpHeader[] httpHeaders;
private bool aspInstalled;
@@ -122,6 +124,18 @@ namespace WebsitePanel.Providers.Web
set { httpErrors = value; }
}
+ public HttpErrorsMode ErrorMode
+ {
+ get { return errorMode; }
+ set { errorMode = value; }
+ }
+
+ public HttpErrorsExistingResponse ExistingResponse
+ {
+ get { return existingResponse; }
+ set { existingResponse = value; }
+ }
+
public string ApplicationPool
{
get { return this.applicationPool; }
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/WebObjects/CustomHttpErrorsModuleService.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/WebObjects/CustomHttpErrorsModuleService.cs
index 91946522..e811aa5e 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/WebObjects/CustomHttpErrorsModuleService.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/WebObjects/CustomHttpErrorsModuleService.cs
@@ -54,6 +54,9 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
var config = srvman.GetWebConfiguration(virtualDir.FullQualifiedPath);
//
var httpErrorsSection = config.GetSection(Constants.HttpErrorsSection);
+
+ virtualDir.ErrorMode = (HttpErrorsMode)httpErrorsSection.GetAttributeValue("errorMode");
+ virtualDir.ExistingResponse = (HttpErrorsExistingResponse)httpErrorsSection.GetAttributeValue("existingResponse");
//
var errorsCollection = httpErrorsSection.GetCollection();
//
@@ -87,10 +90,6 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
}
#endregion
- // Http errors list is either empty or not set so defaults to the parent
- if (virtualDir.HttpErrors == null || virtualDir.HttpErrors.Length == 0)
- return;
-
#region Put the change in effect
using (var srvman = GetServerManager())
{
@@ -98,33 +97,45 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
var section = config.GetSection(Constants.HttpErrorsSection);
- // enable custom errors
- section.SetAttributeValue("errorMode", "Custom");
+ // set error mode
+ section.SetAttributeValue("errorMode", virtualDir.ErrorMode);
+ if (virtualDir.ErrorMode == HttpErrorsMode.Detailed)
+ {
+ section.SetAttributeValue("existingResponse", HttpErrorsExistingResponse.PassThrough);
+ }
+ else
+ {
+ section.SetAttributeValue("existingResponse", HttpErrorsExistingResponse.Auto);
+ }
- //
- var errorsCollection = section.GetCollection();
- //
- foreach (var item in virtualDir.HttpErrors)
- {
- int indexOf = FindHttpError(errorsCollection, item);
- // Just update the element attributes - IIS 7 API will do the rest
- if (indexOf > -1)
- {
- var item2Renew = errorsCollection[indexOf];
- //
- FillConfigurationElementWithData(item2Renew, item, virtualDir);
- //
- continue;
- }
- //
- var item2Add = CreateHttpError(errorsCollection, item, virtualDir);
- //
- if (item2Add == null)
- continue;
- //
- errorsCollection.Add(item2Add);
- }
- //
+ // save custom errors
+ if (virtualDir.HttpErrors != null && virtualDir.HttpErrors.Length > 0)
+ {
+ var errorsCollection = section.GetCollection();
+ //
+ foreach (var item in virtualDir.HttpErrors)
+ {
+ int indexOf = FindHttpError(errorsCollection, item);
+ // Just update the element attributes - IIS 7 API will do the rest
+ if (indexOf > -1)
+ {
+ var item2Renew = errorsCollection[indexOf];
+ //
+ FillConfigurationElementWithData(item2Renew, item, virtualDir);
+ //
+ continue;
+ }
+ //
+ var item2Add = CreateHttpError(errorsCollection, item, virtualDir);
+ //
+ if (item2Add == null)
+ continue;
+ //
+ errorsCollection.Add(item2Add);
+ }
+ }
+
+ //
srvman.CommitChanges();
}
#endregion
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesCustomErrorsControl.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesCustomErrorsControl.ascx.resx
index 8b02047a..a9163103 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesCustomErrorsControl.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesCustomErrorsControl.ascx.resx
@@ -156,4 +156,7 @@
+ |
+
+ |
+