wsp-10212 fixed: option set deatiled error mode on web site

This commit is contained in:
Ruslan Keba 2013-11-08 12:34:33 +02:00
parent 0a16e252c9
commit aa4db51dd5
7 changed files with 133 additions and 34 deletions

View file

@ -156,4 +156,7 @@
<data name="IIS7.Redirect" xml:space="preserve">
<value>Redirect</value>
</data>
<data name="lblErrorMode.Text">
<value xml:space="preserve">Error Mode</value>
</data>
</root>

View file

@ -1,4 +1,19 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebSitesCustomErrorsControl.ascx.cs" Inherits="WebsitePanel.Portal.WebSitesCustomErrorsControl" %>
<div style="padding: 20; margin-bottom: 10px;">
<table cellpadding="4">
<tr id="rowAspNet" runat="server">
<td class="SubHead">
<asp:Label ID="lblErrorMode" runat="server" meta:resourcekey="lblErrorMode"></asp:Label>:
</td>
<td class="Normal">
<asp:DropDownList ID="ddlErrorMode" runat="server" CssClass="NormalTextBox"></asp:DropDownList>
</td>
</tr>
</table>
</div>
<div class="FormButtonsBar">
<asp:Button id="btnAdd" runat="server" meta:resourcekey="btnAddError" Text="Add Custom Error" CssClass="Button3" OnClick="btnAdd_Click" CausesValidation="False"></asp:Button>
</div>

View file

@ -63,16 +63,29 @@ namespace WebsitePanel.Portal
{
IIs7 = item.IIs7;
// bind data
// bind error mode
ddlErrorMode.Items.Add(HttpErrorsMode.DetailedLocalOnly.ToString());
ddlErrorMode.Items.Add(HttpErrorsMode.Custom.ToString());
ddlErrorMode.Items.Add(HttpErrorsMode.Detailed.ToString());
ddlErrorMode.SelectedValue = item.ErrorMode.ToString();
// bind errors list
gvErrorPages.DataSource = item.HttpErrors;
gvErrorPages.DataBind();
}
public void SaveWebItem(WebVirtualDirectory item)
{
item.ErrorMode = GetSelectedErrorMode();
item.HttpErrors = CollectFormData(false).ToArray();
}
private HttpErrorsMode GetSelectedErrorMode()
{
return (HttpErrorsMode)Enum.Parse(typeof (HttpErrorsMode), ddlErrorMode.SelectedValue);
}
public List<HttpError> CollectFormData(bool includeEmpty)
{
List<HttpError> errors = new List<HttpError>();

View file

@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@ -13,6 +12,33 @@ namespace WebsitePanel.Portal {
public partial class WebSitesCustomErrorsControl {
/// <summary>
/// rowAspNet control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow rowAspNet;
/// <summary>
/// lblErrorMode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblErrorMode;
/// <summary>
/// ddlErrorMode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlErrorMode;
/// <summary>
/// btnAdd control.
/// </summary>