0

I have a webpart with 3 custom properties that I have deployed in my development environment and in my testing environment without issues, but when it gets deployed in production the custom properties are having a problems.

Its like they persisted just in one of the servers of the farm, or something, if I enter de properties field, after saving a custom property, I see it empty, like it didn't saved, but the function that depends on it works like 1 of 10 times, as if it did got saved but isn't always accessed.

This is my code:

[ToolboxItemAttribute(false)]
public class EmpaquetamientoWP : WebPart
{
    private const string _ascxPath = @"~/_CONTROLTEMPLATES/EmpaquetamientoWP/EmpaquetamientoWPControl.ascx";

    protected override void CreateChildControls()
    {
        Control control = Page.LoadControl(_ascxPath);
        Controls.Add(control);
    }

    public static string Mail_From;
    [Category("Configuración adicional"),
    Personalizable(PersonalizationScope.Shared),
    WebBrowsable(true),
    WebDisplayName("Email de origen"),
    WebDescription("Por favor defina el email del que se envía el correo")]
    public string _Mail_From
    {
        get { return Mail_From; }
        set
        {
            // Validación de correo
            Regex oRegEx = new Regex("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
            if (!oRegEx.IsMatch(value))
                throw new Microsoft.SharePoint.WebPartPages.
                    WebPartPageUserException(
                    "Por favor use una dirección de correo válida");
            Mail_From = value;
        }
    }

    public static string Mail_To;
    [Category("Configuración adicional"),
    Personalizable(PersonalizationScope.Shared),
    WebBrowsable(true),
    WebDisplayName("Email de destino"),
    WebDescription("Por favor defina el email al que se envía el correo")]
    public string _Mail_To
    {
        get { return Mail_To; }
        set
        {
            // Validación de correo
            Regex oRegEx = new Regex("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
            if (!oRegEx.IsMatch(value))
                throw new Microsoft.SharePoint.WebPartPages.
                    WebPartPageUserException(
                    "Por favor use una dirección de correo válida");
            Mail_To = value;
        }
    }

    public static string Mail_Subject;
    [Category("Configuración adicional"),
    Personalizable(PersonalizationScope.Shared),
    WebBrowsable(true),
    WebDisplayName("Asunto de Email"),
    WebDescription("Por favor defina el asunto del correo")]
    public string _Mail_Subject
    {
        get { return Mail_Subject; }
        set
        {
            // Validación de correo
            Regex oRegEx = new Regex("[a-zA-Z0-9 ]+");
            if (!oRegEx.IsMatch(value))
                throw new Microsoft.SharePoint.WebPartPages.
                    WebPartPageUserException(
                    "Por favor use solo caracteres alphanumericos");
            Mail_Subject = value;
        }
    }


}

Thanks

3
  • Is JavaScript, CSS of pages are same in production and testing? Also make sure both have same webpart in the webpart gallery. Sometimes it may not replaced and the DLL could have replaced. Aug 13, 2014 at 14:44
  • Hi, Tks I checked and they're the same, do you think it could be something else?
    – Ana Franco
    Aug 13, 2014 at 15:12
  • Another small check. Does the person who change the properties has Configuration DB write access? Aug 13, 2014 at 15:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.