Results 1 to 7 of 7

Thread: Unable to add SmarterMail Service

  1. #1
    Member
    Join Date
    May 2011
    Posts
    50

    Default Unable to add SmarterMail Service

    Now I am unable to add the SmarterMail service to this server, it accepts the password, but then I get the below error:

    Error occured while processing the requested page
    Application: System Administrator Interface (SAI/RI)
    Module:
    Method:
    Message: Date: 1/1/0001 8:00:00 AM (UT)
    Source: System.Web


    Page Details
    Referer: http://localhost:2086/Pages/Win1/Con...rSettings.aspx


    User Details
    User Name: Admin
    IP Address: ::1


    Exception Details
    .Source: System.Web
    .Message: A potentially dangerous Request.Form value was detected from the client (ctl00$contentPlaceHolder$serverManagerCtl$addNewServicePopup$AddNewServiceModPopup$AddNewServiceModPopupContainer$smServiceCredential$txtPassword="PASSWORDHERE").
    .Inner Messages:

    .Stack Trace:
    at System.Web.HttpRequest.ValidateString(String s, String valueName, String collectionName) at System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, String collectionName) at System.Web.HttpRequest.get_Form() at System.Web.HttpRequest.get_HasForm() at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) at System.Web.UI.Page.DeterminePostBackMode() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at cPanel.Application.SAI.Pages.ServerSettings.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    Taylor Nelson | Managing Director
    Phone: 1300 136 346 | Fax: 1300 136 347

  2. #2
    cPanel Staff cPanelSalinas's Avatar
    Join Date
    Feb 2009
    Posts
    644

    Default Re: Unable to add SmarterMail Service

    It looks like you'll need to recompile the web.config for SAI.

    1. Open this file and add a random space at the bottom, then save & close:

    C:\Program Files\cPanel\Enkompass\WebInterface\SAI\web.config

    2. Restart Enkompass Web Service and Enkompass Web Server Service.

    3. If you still get the error, rename web.config to web.OLD. Restart those services again. Change the file name back to web.config. Start the services again.

    I know that sounds weird but I can usually get it to work using that method. I haven't figured out why it happens but it shouldn't be a common occurrence.

  3. #3
    Member
    Join Date
    May 2011
    Posts
    50

    Default Re: Unable to add SmarterMail Service

    Hello

    Unfortunately that didn't help.

    Did you see where it says:

    IP Address: ::1
    Perhaps that is the issue?
    Taylor Nelson | Managing Director
    Phone: 1300 136 346 | Fax: 1300 136 347

  4. #4
    cPanel Staff cPanelSalinas's Avatar
    Join Date
    Feb 2009
    Posts
    644

    Default Re: Unable to add SmarterMail Service

    I'm pretty sure it's a web.config issue. Try those steps again but restart the Enkompass WCF Service each time. Make sure you refresh the browser, also.

  5. #5
    Member
    Join Date
    May 2011
    Posts
    50

    Default Re: Unable to add SmarterMail Service

    I have just done it again, and I am still having the same issue (I even restarted the WCF service this time)

    The error is very strange - the date and time is 1/1/0001 8:00:00 AM UT ????

    After renaming the web.config file however, I get an ASP error (which I assume is normal) - perhaps this can help? This is before I restart the services for a second time after renaming back to web.config.

    PHP Code:
    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Compilation Error 
    Description
    An error occurred during the compilation of a resource required to service this requestPlease review the following specific error details and modify your source code appropriately

    Compiler Error MessageCS1031Type expected

    Source Error
    :

     

    Line 75:         /// <param name="type">The type.</param>
    Line 76:         /// <returns></returns>
    Line 77:         internal static Control FindFirstControlByType(this ControlCollection controlsType type)
    Line 78:         {
    Line 79:             foreach (Control control in controls)
     

    Source Filec:\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs    Line77 



    Show Detailed Compiler Output
    :


    C:\Windows\system32"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\csc.exe" /t:library /utf8output /R:"C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\1335df84\003d3de7_ad69cb01\ICSharpCode.SharpZipLib.DLL" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\ef239329\000c8bbd_eb18cd01\cPanel.Web.Branding.DLL" /R:"C:\Windows\assembly\GAC_64\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\d5d9f400\00afcdd3_4451cc01\AjaxControlToolkit.DLL" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\eb4d429d\00bdc007_ed18cd01\cPanel.Web.Api.DLL" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorlib.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\e1b29f60\00e8e6d4_baeec901\Newtonsoft.Json.DLL" /R:"C:\Windows\assembly\GAC_64\cpCoreDefinitions\3.0.0.60__006399d4ef0de535\cpCoreDefinitions.dll" /R:"C:\Windows\assembly\GAC_64\cPanel.Contracts\3.0.0.60__006399d4ef0de535\cPanel.Contracts.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\c3163cb9\00362d04_ed18cd01\cPanel.Web.Logging.DLL" /R:"C:\Windows\assembly\GAC_64\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\389ac248\005c0738_eb18cd01\Logging.DLL" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\84c02d56\001b8f17_9e5ecc01\System.ComponentModel.Composition.DLL" /R:"C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\5bb6c9c6\00aad7f0_2bf3cb01\JHSoftware.DnsClient.DLL" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\6bdbfaae\00362d04_ed18cd01\cPanel.ProfileProvider.DLL" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\5e6911b7\00c04fc2_eb18cd01\cPanel.Resources.DLL" /R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\assembly\dl3\70fa8819\00635e05_ed18cd01\cPanel.Web.DLL" /R:"C:\Windows\assembly\GAC_64\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_GlobalResources.67jsjnjr.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\assembly\GAC_MSIL\Microsoft.Web.Administration\7.0.0.0__31bf3856ad364e35\Microsoft.Web.Administration.dll" /out:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.dll" /debug- /optimize+ /w:/nowarn:1659;1699;1701  "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.0.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.28.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.37.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.23.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.4.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.12.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.5.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.31.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.17.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.25.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.30.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.19.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.1.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.24.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.33.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.18.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.13.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.32.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.6.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.26.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.20.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.7.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.15.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.34.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.21.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.39.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.14.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.2.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.8.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.38.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.3.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.36.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.22.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.11.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.27.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.16.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.10.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.40.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.35.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.29.cs" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ae488c13\8e53e9ee\App_Code.gh1mphvd.9.cs"


    Microsoft (RVisual C# 2005 Compiler version 8.00.50727.4927
    for Microsoft (RWindows (R2005 Framework version 2.0.50727
    Copyright 
    (CMicrosoft Corporation 2001-2005. All rights reserved.

    c:\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(77,56): error CS1031Type expected
    c
    :\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(77,94): error CS1044Cannot use more than one type in a for, usingfixed, or declaration statement
    c
    :\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(77,98): error CS1002: ; expected
    c
    :\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(79,38): error CS1002: ; expected
    c
    :\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(79,49): error CS1519Invalid token ')' in class, struct, or interface member declaration
    c
    :\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(81,36): error CS1519Invalid token '(' in class, struct, or interface member declaration
    c
    :\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(81,46): error CS1519Invalid token ')' in class, struct, or interface member declaration
    c
    :\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(82,35): error CS1519Invalid token ';' in class, struct, or interface member declaration
    c
    :\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(84,13): error CS0116namespace does not directly contain members such as fields or methods
    c
    :\Program Files\cPanel\Enkompass\WebInterface\SAI\App_Code\DNSEntryUserControlBase.cs(86,5): error CS1022Type or namespace definition, or end-of-file expected

     



    Show Complete Compilation Source
    :


    Line 1:    //-------------------------------------------------------------------
    Line 2:    // Module: SAIRI
    Line 3:    // Name: DNSEntryUserControlBase.cs    
    Line 4:    // Description: 
    Line 5:    //-------------------------------------------------------------------
    Line 6:    // History:
    Line 7:    //   02/??/2009 - tg - Created.
    Line 8:    //   03/04/2009 - tg - Added SoaRecord property, LoadSoaRecord() and 
    Line 9:    //    GetMinTTL().
    Line 10:   //   03/06/2009 - tg - Added server side validation handlers.
    Line 11:   //   03/18/2009 - tg - Added FormatException calls to the exception 
    Line 12:   //   handler display methods. Added code to turn off the editing row
    Line 13:   //   and show the add row to account for entries not being overwritten
    Line 14:   //   during the next databind.
    Line 15:   //   03/19/2009 - tg - Moved TTL binding to OnListItemCreate().
    Line 16:   //   12/03/2009 - tg - Moved GetAllDnsResourcesForDomainName()
    Line 17:   //   from the individual UserControls() to here.
    Line 18:   //   03/08/2010 - tg - Added code to set the focus to the first text
    Line 19:   //   box for edit and add operations.  Added a method to compare the
    Line 20:   //   user supplied hostname with the ones generated on the server: 
    Line 21:   //   these names may differ by the automatically applied zone name 
    Line 22:   //   if the short cut entry was added....
    Line 23:   //   04/07/2010 - rf - Fixed FogBug #39551 changed 
    Line 24:   //   DisplayError("Failed to retrieve the DNS entries.", ex);
    Line 25:   //   to DisplayError("Failed to retrieve the DNS entries.") so the 
    Line 26:   //   exception would not display to the user
    Line 27:   //   04/13/2010 - tg - Spell checked. Fix for FB#39552
    Line 28:   //   04/20/2010 - ss - FB#39552 Added null check to GetDnsResources().
    Line 29:   //   10/15/2010 - rf - FB#43329 Added IsActiveDirectoryDomain and ClientScriptConfirm
    Line 30:   //   methods. IsActiveDirectoryDomain determines if the Nshost is a domain controller or not
    Line 31:   //   ClientScriptConfirm outputs returns javascript confirm script if the Nshost
    Line 32:   //   is a domain controller.
    Line 33:   //   05/13/2011 - ss - FB#44528 Fixed IsActiveDirectoryDomain method.
    Line 34:   //   01/04/2012 - ss - FB#45574 Made changes to IsActiveDirectoryDomain method to check if the user
    Line 35:   //                     has admin privileges before checking if Nshost is a domain controller.
    Line 36:   //              - ss - revert the changes made in previous commit. Made changes to GetDomainControllersForDomain()
    Line 37:   //                     to list computers if the user has edit dns privilege or admin privilege.
    Line 38:   //-------------------------------------------------------------------
    Line 39:   // Notes:
    Line 40:   //-------------------------------------------------------------------
    Line 41:   // Copyright © cPanel, Inc. 2009 - 2011 All Rights Reserved
    Line 42:   //-------------------------------------------------------------------
    Line 43:   
    Line 44:   //----------------
    Line 45:   // Includes
    Line 46:   //----------------
    Line 47:   using System;
    Line 48:   using System.Collections.Generic;
    Line 49:   using System.Linq;
    Line 50:   using System.Text;
    Line 51:   using System.Web;
    Line 52:   using System.Web.UI;
    Line 53:   using System.Web.UI.WebControls;
    Line 54:   using System.Web.UI.HtmlControls;
    Line 55:   
    Line 56:   using cPanel.Core;
    Line 57:   using cPanel.Dns;
    Line 58:   using cPanel.Web;
    Line 59:   using cPanel.Web.Helpers;
    Line 60:   using cPanel.Web.Exceptions;
    Line 61:   using cPanel.Web.Applications.Common;
    Line 62:   using cPanel.Web.Applications.SAI;
    Line 63:   using System.Web.Security;
    Line 64:   
    Line 65:   
    Line 66:   namespace cPanel.Applications.SAI.DNS
    Line 67
    :   {
    Line 68:   
    Line 69:       public static class ControlCollectionExtensions
    Line 70
    :       {
    Line 71:           /// <summary>
    Line 72:           /// Finds the first type of the control by.
    Line 73:           /// </summary>
    Line 74:           /// <param name="controls">The controls.</param>
    Line 75:           /// <param name="type">The type.</param>
    Line 76:           /// <returns></returns>
    Line 77:           internal static Control FindFirstControlByType(this ControlCollection controlsType type)
    Line 78:           {
    Line 79:               foreach (Control control in controls)
    Line 80:               {
    Line 81:                   if (control.GetType() == type)
    Line 82:                       return control;
    Line 83:               }
    Line 84:               return null;
    Line 85:           }
    Line 86:       }
    Line 87:   
    Line 88:       /// <summary>
    Line 89:       /// Summary description for DNSEntryUserControlBase
    Line 90:       /// </summary>
    Line 91:       public abstract class DNSEntryUserControlBase
    Line 92
    :           : BaseUserControl
    Line 93
    :       {
    Line 94:           public DNSEntryUserControlBase()
    Line 95:           {
    Line 96:           }
    Line 97:   
    Line 98:   
    Line 99:           private cPanel.Web.Applications.SAI.SaiPage.Computer[] _computers;
    Line 100:  
    Line 101:          /// <summary>
    Line 102:          /// Determines whether [is active directory domain] [the specified ns host].
    Line 103:          /// </summary>
    Line 104:          /// <param name="NsHost">The ns host.</param>
    Line 105:          /// <returns>
    Line 106:          ///     <c>true</c> if [is active directory domain] [the specified ns host]; otherwise, <c>false</c>.
    Line 107:          /// </returns>
    Line 108:          protected bool IsActiveDirectoryDomain(string NsHost)
    Line 109:          {
    Line 110:              if (_computers == null)
    Line 111:              {
    Line 112:                  _computers cPanel.Web.Applications.SAI.SaiPage.GetDomainControllersForDomain(false);
    Line 113:              }
    Line 114:              if (_computers != null &&
    Line 115:                  _computers.Length 0)
    Line 116:              {
    Line 117:                  foreach (cPanel.Web.Applications.SAI.SaiPage.Computer comp in _computers)
    Line 118:                  {
    Line 119:                      if (NsHost.EndsWith(comp.HostNameStringComparison.CurrentCultureIgnoreCase))
    Line 120:                      {
    Line 121:                          return true;
    Line 122:                      }
    Line 123:                  }
    Line 124:              }
    Line 125:              return false;
    Line 126:          }
    Line 127:  
    Line 128:          /// <summary>
    Line 129:          /// Clients the script confirm.
    Line 130:          /// </summary>
    Line 131:          /// <param name="NsHost">The ns host.</param>
    Line 132:          /// <returns></returns>
    Line 133:          protected string ClientScriptConfirm(string NsHost)
    Line 134:          {
    Line 135:              if (IsActiveDirectoryDomain(NsHost))
    Line 136:                  return string.Empty;
    Line 137:              else
    Line 138:                  return string.Format("return confirm('Are you sure you want to delete the selected DNS {0} record?');"this.ResourceTypeName);
    Line 139:          }
    Line 140:  
    Line 141:          private DnsResourceType _type DnsResourceType.Invalid;
    Line 142:          /// <summary>
    Line 143:          /// Gets or sets the type of the resource.
    Line 144:          /// </summary>
    Line 145:          /// <value>The type of the resource.</value>
    Line 146:          public DnsResourceType ResourceType
    Line 147
    :          {
    Line 148:              get { return _type; }
    Line 149:              set _type value; }
    Line 150:          }
    Line 151:  
    Line 152:          private string _typeName "";
    Line 153:          /// <summary>
    Line 154:          /// Gets or sets the name of the resource type.
    Line 155:          /// </summary>
    Line 156:          /// <value>The name of the resource type.</value>
    Line 157:          public string ResourceTypeName
    Line 158
    :          {
    Line 159:              get { return _typeName; }
    Line 160:              set _typeName value; }
    Line 161:          }
    Line 162:  
    Line 163:          private string _typeDescription "";
    Line 164:          /// <summary>
    Line 165:          /// Gets or sets the resource type description.
    Line 166:          /// </summary>
    Line 167:          /// <value>The resource type description.</value>
    Line 168:          public string ResourceTypeDescription
    Line 169
    :          {
    Line 170:              get { return _typeDescription; }
    Line 171:              set _typeDescription value; }
    Line 172:          }
    Line 173:  
    Line 174:          /// <summary>
    Line 175:          /// Gets or sets the zone.
    Line 176:          /// </summary>
    Line 177:          /// <value>The zone.</value>
    Line 178:          public string Zone
    Line 179
    :          {
    Line 180:              get
    Line 181
    :              {
    Line 182:                  return (string)(ViewState["Zone"] ?? "");
    Line 183:              }
    Line 184:              set
    Line 185
    :              {
    Line 186:                  ViewState["Zone"] = value;
    Line 187:              }
    Line 188:          }
    Line 189:  
    Line 190:          private SaiPage _editor null;
    Line 191:          /// <summary>
    Line 192:          /// Gets the editor.
    Line 193:          /// </summary>
    Line 194:          /// <value>The editor.</value>
    Line 195:          public SaiPage Editor
    Line 196
    :          {
    Line 197:              get
    Line 198
    :              {
    Line 199:                  if (_editor == null && this.Page != null)
    Line 200:                  {
    Line 201:                      _editor this.Page as SaiPage;
    Line 202:                  }
    Line 203:                  return _editor;
    Line 204:              }
    Line 205:          }
    Line 206:  
    Line 207:          /// <summary>
    Line 208:          /// Compares the name of the DNS host. 
    Line 209:          /// </summary>
    Line 210:          /// <remarks>This method assumes that host1 is generated by the Microsoft DNS Server rules and 
    Line 211:          /// host2 is the text entered by the user.</remarks>
    Line 212:          /// <param name="host1">The host name on DNS Server.</param>
    Line 213:          /// <param name="host2">The host name entered by the user, may be just the name without the zone appended.</param>
    Line 214:          /// <param name="zone">The zone.</param>
    Line 215:          /// <returns></returns>
    Line 216:          protected bool CompareDnsHostName(string host1string host2string zone)
    Line 217:          {
    Line 218:              if (host1 == host2)
    Line 219:                  return true;
    Line 220:  
    Line 221:              if (!host2.EndsWith("."))
    Line 222:              {
    Line 223:                  host2 host2 "." zone;
    Line 224:              }
    Line 225:              return host1 == host2;
    Line 226:          }
    Line 227:  
    Line 228:  
    Line 229:          private ListView _list null;
    Line 230:          /// <summary>
    Line 231:          /// Gets the list.
    Line 232:          /// </summary>
    Line 233:          /// <value>The list.</value>
    Line 234:          public ListView List
    Line 235:          {
    Line 236:              get
    Line 237
    :              {
    Line 238:                  if (_list == null)
    Line 239:                  {
    Line 240:                      _list this.FindControl("listServers") as ListView;
    Line 241:                  }
    Line 242:                  return _list;
    Line 243:              }
    Line 244:          }
    Line 245:  
    Line 246:          protected DnsResource[] _resources null;
    Line 247:          /// <summary>
    Line 248:          /// Gets or sets the resources.
    Line 249:          /// </summary>
    Line 250:          /// <value>The resources.</value>
    Line 251:          public DnsResource[] Resources
    Line 252
    :          {
    Line 253:              get
    Line 254
    :              {
    Line 255:                  if (_resources == null)
    Line 256:                  {
    Line 257:                      _resources = (DnsResource[])(ViewState["Resources"] ?? new DnsResource[0]);
    Line 258:                  }
    Line 259:                  return _resources;
    Line 260:              }
    Line 261:              set
    Line 262
    :              {
    Line 263:                  ViewState["Resources"] = value;
    Line 264:                  _resources value;
    Line 265:              }
    Line 266:          }
    Line 267:  
    Line 268:  
    Line 269:  
    Line 270:          /// <summary>
    Line 271:          /// Binds a data source to the invoked server control and all its child controls.
    Line 272:          /// </summary>
    Line 273:          public void DataBind()
    Line 274:          {
    Line 275:              BindData();
    Line 276:          }
    Line 277:  
    Line 278:          /// <summary>
    Line 279:          /// Handles the Load event of the Page control.
    Line 280:          /// </summary>
    Line 281:          /// <param name="sender">The source of the event.</param>
    Line 282:          /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    Line 283:          protected void Page_Load(object senderEventArgs e)
    Line 284:          {
    Line 285:              ClearMessage();
    Line 286:          }
    Line 287:  
    Line 288:          /// <summary>
    Line 289:          /// Binds a data source to the invoked server control and all its child controls with an option to raise the <see cref="E:System.Web.UI.Control.DataBinding"/> event.
    Line 290:          /// </summary>
    Line 291:          /// <param name="raiseOnDataBinding">true if the <see cref="E:System.Web.UI.Control.DataBinding"/> event is raised; otherwise, false. The default is false.</param>
    Line 292:          protected override void DataBind(bool raiseOnDataBinding)
    Line 293:          {
    Line 294:              base.DataBind(raiseOnDataBinding);
    Line 295:              BindData();
    Line 296:          }
    Line 297:  
    Line 298:          /// <summary>
    Line 299:          /// Binds the data.
    Line 300:          /// </summary>
    Line 301:          private void BindData()
    Line 302:          {
    Line 303:              if (string.IsNullOrEmpty(this.Zone)) return;
    Line 304:              try { this.SoaRecord LoadSoaRecord(); }
    Line 305:              catch (Exception ex) { DisplayError(ex); return; }
    Line 306:              RefreshResourceList();
    Line 307:              this.List.DataSource this.Resources;
    Line 308:              this.List.DataBind();            
    Line 309:          }
    Line 310:  
    Line 311:          /// <summary>
    Line 312:          /// News the server.
    Line 313:          /// </summary>
    Line 314:          /// <param name="sender">The sender.</param>
    Line 315:          /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    Line 316:          protected void OnListAddNewItem(object senderEventArgs e)
    Line 317:          {
    Line 318:              this.List.EditIndex = -1;
    Line 319:              this.List.InsertItemPosition InsertItemPosition.LastItem;
    Line 320:              HideNewButton();
    Line 321:              BindData();
    Line 322:              
    Line 323:              //BindMinTTL(this.List.Items[this.List.Items.Count - 1]);              
    Line 324:              
    Line 325:              ListViewItem row this.List.InsertItem;
    Line 326:              if (row != null)
    Line 327:              {
    Line 328:                  Control first row.Controls.FindFirstControlByType(typeof(TextBox));
    Line 329:                  if (first != null)
    Line 330:                      PagePlus.SetFocus(first.ClientID);
    Line 331:              }
    Line 332:          }
    Line 333:  
    Line 334:          /// <summary>
    Line 335:          /// Commands the list.
    Line 336:          /// </summary>
    Line 337:          /// <param name="sender">The sender.</param>
    Line 338:          /// <param name="e">The <see cref="System.Web.UI.WebControls.ListViewCommandEventArgs"/> instance containing the event data.</param>
    Line 339:          protected void OnListItemCommand(object senderListViewCommandEventArgs e)
    Line 340:          {
    Line 341:              if (e.CommandName.ToUpper() == "SAVE")
    Line 342:              {
    Line 343:                  SaveItem(e.Item);
    Line 344:                  this.List.EditIndex = -1;
    Line 345:                  this.List.InsertItemPosition InsertItemPosition.None;
    Line 346:                  ShowNewButton();            
    Line 347:                  DataBind();                                
    Line 348:              }
    Line 349:          }
    Line 350:  
    Line 351:          /// <summary>
    Line 352:          /// Inserts the list.
    Line 353:          /// </summary>
    Line 354:          /// <param name="sender">The sender.</param>
    Line 355:          /// <param name="e">The <see cref="System.Web.UI.WebControls.ListViewInsertEventArgs"/> instance containing the event data.</param>
    Line 356:          protected void OnListInsertItem(Object senderListViewInsertEventArgs e)
    Line 357:          {
    Line 358:              this.List.InsertItemPosition InsertItemPosition.None;
    Line 359:              BindData();
    Line 360:              BindMinTTL(this.List.InsertItem);
    Line 361:          }
    Line 362:  
    Line 363:          /// <summary>
    Line 364:          /// Cancels the insert mode.
    Line 365:          /// </summary>
    Line 366:          protected void CancelInsertMode()
    Line 367:          {
    Line 368:              this.List.InsertItemPosition InsertItemPosition.None;
    Line 369:              ShowNewButton();
    Line 370:              BindData();
    Line 371:          }
    Line 372:  
    Line 373:          /// <summary>
    Line 374:          /// Shows the new button.
    Line 375:          /// </summary>
    Line 376:          private void ShowNewButton()
    Line 377:          {
    Line 378:              Control row this.List.FindControl("rowNew");
    Line 379:              if(row != null)
    Line 380:                  row.Visible true;
    Line 381:          }
    Line 382:  
    Line 383:          /// <summary>
    Line 384:          /// Hides the new button.
    Line 385:          /// </summary>
    Line 386:          private void HideNewButton()
    Line 387:          {
    Line 388:              Control row this.List.FindControl("rowNew");
    Line 389:              if (row != null)
    Line 390:                  row.Visible false;
    Line 391:          }
    Line 392:  
    Line 393:          /// <summary>
    Line 394:          /// Saves the item.
    Line 395:          /// </summary>
    Line 396:          /// <param name="item">The item.</param>
    Line 397:          protected abstract void SaveItem(ListViewItem item);
    Line 398:  
    Line 399:          /// <summary>
    Line 400:          /// Updates the item.
    Line 401:          /// </summary>
    Line 402:          /// <param name="item">The item.</param>
    Line 403:          protected abstract void UpdateItem(ListViewItem item);
    Line 404:  
    Line 405:          /// <summary>
    Line 406:          /// Deletes the item.
    Line 407:          /// </summary>
    Line 408:          /// <param name="item">The item.</param>
    Line 409:          protected abstract void DeleteItem(ListViewItem item);
    Line 410:  
    Line 411:          /// <summary>
    Line 412:          /// Refreshes the list.
    Line 413:          /// </summary>
    Line 414:          protected abstract void RefreshResourceList();
    Line 415:  
    Line 416:          protected DnsResource[] GetDnsResources<T>(DnsResourceType type
    Line 417:              where T DnsResource
    Line 418
    :          {
    Line 419:              DnsResource[] allResources = new DnsResource[0];
    Line 420:  
    Line 421:              try
    Line 422:              {
    Line 423:                  try
    Line 424:                  {
    Line 425:                      allResources this.Editor.SaiProxy.GetAllDnsResourcesForDomainName(this.Zone);
    Line 426:                  }
    Line 427:                  catch (Exception ex)
    Line 428:                  {
    Line 429:                      throw new WebAppAPIException(0,
    Line 430:                          this.Editor.ProxyInterfaceName,
    Line 431:                          "GetAllDnsResourcesForDomainName",
    Line 432:                          string.Format("Could not retrieve the DNS entries for zone '{0}'."this.Zone),
    Line 433:                          ex);
    Line 434:                  }
    Line 435:  
    Line 436:                  if (allResources != null && allResources.Length 0)
    Line 437:                  {
    Line 438:  
    Line 439:                      // Filter out the resources by type and convert to the 
    Line 440:                      DnsResource[] resources =
    Line 441:                          Array.FindAll<DnsResource>(
    Line 442:                          allResources,
    Line 443:                          delegate(DnsResource r)
    Line 444:                          {
    Line 445:                              return r.ResourceType == type;
    Line 446:                          });
    Line 447:  
    Line 448:                      // Return the converted list
    Line 449:                      return Array.ConvertAll<DnsResourceT>(resources,
    Line 450:                          delegate(DnsResource res)
    Line 451:                          {
    Line 452:                              return res as T;
    Line 453:                          });
    Line 454:                  }
    Line 455:  
    Line 456:              }
    Line 457:              catch (Exception ex)
    Line 458:              {
    Line 459:                  DisplayError("Failed to retrieve the DNS entries.");
    Line 460:              }
    Line 461:  
    Line 462:              return allResources;
    Line 463:          }
    Line 464:  
    Line 465:          /// <summary>
    Line 466:          /// Cancels the list.
    Line 467:          /// </summary>
    Line 468:          /// <param name="sender">The sender.</param>
    Line 469:          /// <param name="e">The <see cref="System.Web.UI.WebControls.ListViewCancelEventArgs"/> instance containing the event data.</param>
    Line 470:          protected void OnListCancelItem(Object senderListViewCancelEventArgs e)
    Line 471:          {
    Line 472:              if (e.CancelMode == ListViewCancelMode.CancelingEdit)
    Line 473:              {
    Line 474:                  this.List.EditIndex = -1;
    Line 475:                  BindData();
    Line 476:              }
    Line 477:              else if (e.CancelMode == ListViewCancelMode.CancelingInsert)
    Line 478:              {
    Line 479:                  CancelInsertMode();
    Line 480:              }
    Line 481:          }
    Line 482:  
    Line 483:      
    Line 484:          /// <summary>
    Line 485:          /// Updates the list.
    Line 486:          /// </summary>
    Line 487:          /// <param name="sender">The sender.</param>
    Line 488:          /// <param name="e">The <see cref="System.Web.UI.WebControls.ListViewUpdateEventArgs"/> instance containing the event data.</param>
    Line 489:          protected void OnListUpdateItem(Object senderListViewUpdateEventArgs e)
    Line 490:          {
    Line 491:              // Get the current item being edited
    Line 492:              ListViewItem myItem this.List.Items[this.List.EditIndex];
    Line 493:  
    Line 494:              UpdateItem(myItem);
    Line 495:  
    Line 496:              // get out of the edit mode
    Line 497:              this.List.EditIndex = -1;
    Line 498:  
    Line 499:              // bind the listview
    Line 500:              BindData();
    Line 501:          }
    Line 502:  
    Line 503:          /// <summary>
    Line 504:          /// Edits the list.
    Line 505:          /// </summary>
    Line 506:          /// <param name="sender">The sender.</param>
    Line 507:          /// <param name="e">The <see cref="System.Web.UI.WebControls.ListViewEditEventArgs"/> instance containing the event data.</param>
    Line 508:          protected void OnListEditItem(object senderListViewEditEventArgs e)
    Line 509:          {
    Line 510:              int editIndex e.NewEditIndex;
    Line 511:              // Set the Listview to Editmode
    Line 512:              this.List.EditIndex editIndex;
    Line 513:  
    Line 514:              // Bind the view 
    Line 515:              BindData();
    Line 516:              BindMinTTL(this.List.EditItem); 
    Line 517:  
    Line 518:              ListViewDataItem row this.List.Items[editIndex];
    Line 519:              if(row != null)
    Line 520:              {
    Line 521:                  Control first row.Controls.FindFirstControlByType(typeof(TextBox));
    Line 522:                  if (first != null)
    Line 523:                      PagePlus.SetFocus(first.ClientID);
    Line 524:              }
    Line 525:          }
    Line 526:  
    Line 527:          /// <summary>
    Line 528:          /// Deletes the list.
    Line 529:          /// </summary>
    Line 530:          /// <param name="sender">The sender.</param>
    Line 531:          /// <param name="e">The <see cref="System.Web.UI.WebControls.ListViewDeleteEventArgs"/> instance containing the event data.</param>
    Line 532:          protected void OnListDeleteItem(Object senderListViewDeleteEventArgs e)
    Line 533:          {
    Line 534:              // Get the current item being deleted
    Line 535:              ListViewItem myItem this.List.Items[e.ItemIndex];
    Line 536:  
    Line 537:              // Delete the item
    Line 538:              DeleteItem(myItem);
    Line 539:              
    Line 540:              // Refresh the UI
    Line 541:              BindData();
    Line 542:  
    Line 543:          }
    Line 544:  
    Line 545:          /// <summary>
    Line 546:          /// Called when [list item created].
    Line 547:          /// </summary>
    Line 548:          /// <param name="sender">The sender.</param>
    Line 549:          /// <param name="e">The <see cref="System.Web.UI.WebControls.ListViewItemEventArgs"/> instance containing the event data.</param>
    Line 550:          protected void OnListItemCreated(object senderListViewItemEventArgs e)
    Line 551:          {
    Line 552:              if (e.Item.ItemType == ListViewItemType.EmptyItem ||
    Line 553:                  e.Item.ItemType == ListViewItemType.InsertItem)
    Line 554:              {
    Line 555:                  BindMinTTL(e.Item);
    Line 556:              }
    Line 557:          }
    Line 558:  
    Line 559:          /// <summary>
    Line 560:          /// Datas the bound list.
    Line 561:          /// </summary>
    Line 562:          /// <param name="sender">The sender.</param>
    Line 563:          /// <param name="e">The <see cref="System.Web.UI.WebControls.ListViewItemEventArgs"/> instance containing the event data.</param>
    Line 564:          protected void OnListItemDataBound(Object senderListViewItemEventArgs e)
    Line 565:          {
    Line 566:              if (e.Item.ItemType == ListViewItemType.DataItem)
    Line 567:              {
    Line 568:                  LinkButton lnkDelete e.Item.FindControl("DeleteButton") as LinkButton;
    Line 569:                  //if (lnkDelete != null)
    Line 570:                  //{
    Line 571:                  //    lnkDelete.Attributes.Add(
    Line 572:                  //        "onclick",
    Line 573:                  //        string.Format(
    Line 574:                  //            "return confirm('Are you sure you want to delete the selected DNS {0} record?');",
    Line 575:                  //            this.ResourceTypeName));
    Line 576:                  //}
    Line 577:              }            
    Line 578:          }
    Line 579:  
    Line 580:          /// <summary>
    Line 581:          /// Binds the min TTL.
    Line 582:          /// </summary>
    Line 583:          /// <param name="lv">The lv.</param>
    Line 584:          private void BindMinTTL(ListViewItem lv)
    Line 585:          {
    Line 586:              if (lv != null)
    Line 587:              {
    Line 588:                  int minTTL GetMinTTL();
    Line 589:  
    Line 590:                  RangeValidator rng3 lv.Controls[0].FindControl("rng3") as RangeValidator;
    Line 591:                  if (rng3 != null)
    Line 592:                  {
    Line 593:                      rng3.MinimumValue minTTL.ToString();
    Line 594:                      rng3.ErrorMessage string.Format(rng3.ErrorMessageminTTL);
    Line 595:                  }
    Line 596:  
    Line 597:                  TextBox txtTTL lv.Controls[0].FindControl("txtTTL") as TextBox;
    Line 598:                  if (txtTTL != null)
    Line 599:                  {
    Line 600:                      if (txtTTL.Text == "")
    Line 601:                          txtTTL.Text minTTL.ToString();
    Line 602:                  }
    Line 603:              }
    Line 604:          }
    Line 605:  
    Line 606:          /// <summary>
    Line 607:          /// Called when [list data bound].
    Line 608:          /// </summary>
    Line 609:          /// <param name="sender">The sender.</param>
    Line 610:          /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    Line 611:          protected void OnListDataBound(Object senderEventArgs e)
    Line 612:          {
    Line 613:          }
    Line 614:          
    Line 615:  
    Line 616:          HtmlGenericControl _message null;
    Line 617:          /// <summary>
    Line 618:          /// Gets the message.
    Line 619:          /// </summary>
    Line 620:          /// <value>The message.</value>
    Line 621:          protected HtmlGenericControl Message
    Line 622
    :          {
    Line 623:              get
    Line 624
    :              {
    Line 625:                  if (_message == null)
    Line 626:                  {
    Line 627:                      _message this.Parent.FindControl("message") as HtmlGenericControl;
    Line 628:                  }
    Line 629:                  return _message;
    Line 630:              }
    Line 631:          }
    Line 632:  
    Line 633:          /// <summary>
    Line 634:          /// Clears the message.
    Line 635:          /// </summary>
    Line 636:          protected void ClearMessage()
    Line 637:          {
    Line 638:              this.Message.InnerHtml "";
    Line 639:          }
    Line 640:  
    Line 641:          /// <summary>
    Line 642:          /// Displays the message.
    Line 643:          /// </summary>
    Line 644:          /// <param name="msg">The MSG.</param>
    Line 645:          protected void DisplayMessage(string msg)
    Line 646:          {
    Line 647:              this.Message.InnerHtml 
    Line 648:                  "<p>" 
    Line 649:                  FormatMessage(msg) + 
    Line 650:                  "</p>";
    Line 651:          }
    Line 652:  
    Line 653:          /// <summary>
    Line 654:          /// Displays the error.
    Line 655:          /// </summary>
    Line 656:          /// <param name="msg">The MSG.</param>
    Line 657:          protected void DisplayError(string msg)
    Line 658:          {
    Line 659:              this.Message.InnerHtml 
    Line 660:                  "<p style='color:Red;'>" 
    Line 661:                  FormatMessage(msg) + 
    Line 662:                  "</p>";
    Line 663:          }
    Line 664:  
    Line 665:          /// <summary>
    Line 666:          /// Displays the error.
    Line 667:          /// </summary>
    Line 668:          /// <param name="msg">The MSG.</param>
    Line 669:          /// <param name="ex">The ex.</param>
    Line 670:          protected void DisplayError(Exception ex)
    Line 671:          {
    Line 672:              StringBuilder sb = new StringBuilder();
    Line 673:              sb.Append("<p style='color:Red;'>");
    Line 674:              sb.Append(this.FormatException(ex));
    Line 675:              sb.Append("</p>");
    Line 676:              this.Message.InnerHtml sb.ToString();
    Line 677:          }
    Line 678:  
    Line 679:          /// <summary>
    Line 680:          /// Displays the error.
    Line 681:          /// </summary>
    Line 682:          /// <param name="msg">The MSG.</param>
    Line 683:          /// <param name="ex">The ex.</param>
    Line 684:          protected void DisplayError(string msgException ex)
    Line 685:          {
    Line 686:              StringBuilder sb = new StringBuilder();
    Line 687:              sb.Append("<p style='color:Red;'>");
    Line 688:              sb.Append(FormatMessage(msg) + "<br/>");
    Line 689:              sb.Append(this.FormatException(ex));
    Line 690:              sb.Append("</p>");
    Line 691:  
    Line 692:              this.Message.InnerHtml sb.ToString();
    Line 693:          }
    Line 694:          
    Line 695:          private SoaRecord _soaRecord null;
    Line 696:          /// <summary>
    Line 697:          /// Gets or sets the soa record.
    Line 698:          /// </summary>
    Line 699:          /// <value>The soa record.</value>
    Line 700:          public SoaRecord SoaRecord
    Line 701
    :          {
    Line 702:              get
    Line 703
    :              {
    Line 704:                  if (_soaRecord == null)
    Line 705:                  {
    Line 706:                      _soaRecord = (SoaRecord)(ViewState["soaRecord"] ?? null);                    
    Line 707:                  }
    Line 708:                  return _soaRecord;
    Line 709:              }
    Line 710:              set
    Line 711
    :              {
    Line 712:                  ViewState["soaRecord"] = value;
    Line 713:                  _soaRecord value;
    Line 714:              }
    Line 715:          }
    Line 716:  
    Line 717:          /// <summary>
    Line 718:          /// Loads the soa record.
    Line 719:          /// </summary>
    Line 720:          /// <returns></returns>
    Line 721:          private SoaRecord LoadSoaRecord()
    Line 722:          {
    Line 723:              SoaRecord soarec null;
    Line 724:  
    Line 725:              if (string.IsNullOrEmpty(this.Zone))
    Line 726:                  return null;
    Line 727:  
    Line 728:              try
    Line 729:              {
    Line 730:                  soarec this.Editor.SaiProxy.GetSoaRecordForDomainName(this.Zone);
    Line 731:              }
    Line 732:              catch (Exception ex)
    Line 733:              {
    Line 734:                  throw new WebAppAPIException(0,
    Line 735:                      this.Editor.ProxyInterfaceName,
    Line 736:                      "GetSoaRecordForDomainName",
    Line 737:                      string.Format("Could not retrieve the SOA Record for the '{0}' zone."this.Zone),
    Line 738:                      ex);
    Line 739:              }
    Line 740:          
    Line 741:              return soarec;
    Line 742:          }
    Line 743:  
    Line 744:          /// <summary>
    Line 745:          /// Gets the min TTL.
    Line 746:          /// </summary>
    Line 747:          /// <returns></returns>
    Line 748:          protected int GetMinTTL()
    Line 749:          {
    Line 750:              return (int)((this.SoaRecord != null) ? this.SoaRecord.MinTTL 0);
    Line 751:          }
    Line 752:  
    Line 753:          /// <summary>
    Line 754:          /// Validates the name of the DNS host.
    Line 755:          /// </summary>
    Line 756:          /// <param name="sender">The sender.</param>
    Line 757:          /// <param name="args">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>
    Line 758:          protected void ValidateDNSHostName(object senderServerValidateEventArgs args)
    Line 759:          {
    Line 760:              ValidationResults res 
    Line 761:                  NetworkHelpers.Domains.ValidateDomainName(args.Value);
    Line 762:  
    Line 763:              args.IsValid res.IsValid;
    Line 764:  
    Line 765:              // TODO: What to do with the results string???
    Line 766:  
    Line 767:          }
    Line 768:  
    Line 769:          /// <summary>
    Line 770:          /// Validates the name of the MX host.
    Line 771:          /// </summary>
    Line 772:          /// <param name="sender">The sender.</param>
    Line 773:          /// <param name="args">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>
    Line 774:          protected void ValidatMXHostName(object senderServerValidateEventArgs args)
    Line 775:          {
    Line 776:              ValidationResults res =
    Line 777:                  NetworkHelpers.Domains.ValidateMXEntry(args.Value);
    Line 778:  
    Line 779:              args.IsValid res.IsValid;
    Line 780:  
    Line 781:              // TODO: What to do with the results string???
    Line 782:  
    Line 783:          }
    Line 784:          /// <summary>
    Line 785:          /// Validates the IP v6 address.
    Line 786:          /// </summary>
    Line 787:          /// <param name="sender">The sender.</param>
    Line 788:          /// <param name="args">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>
    Line 789:          protected void ValidateIPV6Address(object senderServerValidateEventArgs args)
    Line 790:          {
    Line 791:              ValidationResults res =
    Line 792:                  NetworkHelpers.IPAddresses.ValidateIPV6Address(args.Value);
    Line 793:  
    Line 794:              args.IsValid res.IsValid;
    Line 795:  
    Line 796:              // TODO: What to do with the results string???
    Line 797:  
    Line 798:          }
    Line 799:  
    Line 800:          /// <summary>
    Line 801:          /// Validates the IP v4 address.
    Line 802:          /// </summary>
    Line 803:          /// <param name="sender">The sender.</param>
    Line 804:          /// <param name="args">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>
    Line 805:          protected void ValidateIPV4Address(object senderServerValidateEventArgs args)
    Line 806:          {
    Line 807:              ValidationResults res =
    Line 808:                              NetworkHelpers.IPAddresses.ValidateIPV6Address(args.Value);
    Line 809:  
    Line 810:              args.IsValid res.IsValid;
    Line 811:  
    Line 812:              // TODO: What to do with the results string???
    Line 813:          }
    Line 814:  
    Line 815:          /// <summary>
    Line 816:          /// Cleans the name of the host.
    Line 817:          /// </summary>
    Line 818:          /// <param name="data">The data.</param>
    Line 819:          /// <returns></returns>
    Line 820:          protected string CleanHostName(object data)
    Line 821:          {
    Line 822:              string name = (string)data;
    Line 823:              if (name.EndsWith("."))
    Line 824:                  return name.Substring(0name.Length 1);
    Line 825:              else
    Line 826:                  return name;
    Line 827:          }
    Line 828:  
    Line 829:          /// <summary>
    Line 830:          /// Gets the name of all DNS resources for domain.
    Line 831:          /// </summary>
    Line 832:          /// <param name="zone">The zone.</param>
    Line 833:          /// <returns></returns>
    Line 834:          protected DnsResource[] GetAllDnsResourcesForDomainName(string zone)
    Line 835:          {
    Line 836:              DnsResource[] list = null;
    Line 837:              try
    Line 838:              {
    Line 839:                  list = this.Editor.SaiProxy.GetAllDnsResourcesForDomainName(zone);
    Line 840:              }
    Line 841:              catch (Exception ex)
    Line 842:              {
    Line 843:                  throw new WebAppAPIException(0,
    Line 844:                      this.Editor.ProxyInterfaceName,
    Line 845:                      "GetAllDnsResourcesForDomainName",
    Line 846:                      string.Format("Could not retrieve the resource for the zone {0}."zone),
    Line 847:                      ex);
    Line 848:              }
    Line 849:              return list;
    Line 850:          }
    Line 851:  
    Line 852:      }
    Line 853:  }
     




    --------------------------------------------------------------------------------
    Version InformationMicrosoft .NET Framework Version:2.0.50727.5456ASP.NET Version:2.0.50727.5456 
    Taylor Nelson | Managing Director
    Phone: 1300 136 346 | Fax: 1300 136 347

  6. #6
    cPanel Staff cPanelSalinas's Avatar
    Join Date
    Feb 2009
    Posts
    644

    Default Re: Unable to add SmarterMail Service

    Were you able to get this fixed?

  7. #7
    Member
    Join Date
    May 2011
    Posts
    50

    Default Re: Unable to add SmarterMail Service

    No? The last thing I said was that it's still broken...
    Taylor Nelson | Managing Director
    Phone: 1300 136 346 | Fax: 1300 136 347

Similar Threads

  1. Unable to contact the ASP.NET session state service.
    By Kikkeh in forum Enkompass Discussions
    Replies: 7
    Last Post: 02-27-2012, 04:37 PM
  2. Add mySQL service error
    By iCARus in forum Enkompass Discussions
    Replies: 4
    Last Post: 02-09-2012, 03:02 PM
  3. Unable to add new IP
    By encryption in forum cPanel & WHM Discussions
    Replies: 6
    Last Post: 10-10-2007, 10:22 AM
  4. <b>How to add service to Service Manager</b>
    By Qoneek in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 08-11-2004, 11:39 AM
  5. Add User with Service Permissions
    By danson in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 06-05-2004, 11:37 AM