Click here to Skip to main content
14,335,764 members

Web Development

 
QuestionHelp with shopping cart Pin
Member 225362218-Feb-19 4:07
memberMember 225362218-Feb-19 4:07 
QuestionWhite space removed by minifier tools affects look and feel of HTML Pin
adi007me13-Feb-19 8:39
memberadi007me13-Feb-19 8:39 
AnswerRe: White space removed by minifier tools affects look and feel of HTML Pin
Richard Deeming13-Feb-19 10:49
mveRichard Deeming13-Feb-19 10:49 
Question[UPDATED ]MVC Web API Controller - Pass List<string> Pin Pin
Kevin Marois12-Feb-19 6:32
professionalKevin Marois12-Feb-19 6:32 
AnswerRe: [UPDATED ]MVC Web API Controller - Pass List<string> Pin Pin
Richard Deeming12-Feb-19 7:54
mveRichard Deeming12-Feb-19 7:54 
GeneralRe: [UPDATED ]MVC Web API Controller - Pass List<string> Pin Pin
Kevin Marois12-Feb-19 8:08
professionalKevin Marois12-Feb-19 8:08 
AnswerRe: [UPDATED ]MVC Web API Controller - Pass List<string> Pin Pin
F-ES Sitecore12-Feb-19 23:14
mveF-ES Sitecore12-Feb-19 23:14 
QuestionASP.Net MVC Serialization Problem - "No parameterless constructor defined for this object" Pin
Kevin Marois11-Feb-19 8:30
professionalKevin Marois11-Feb-19 8:30 
This is a bit long but I'm stuck. Working on a WPF app hitting an ASP.NET Web API.

Not sure why but I started getting this message. I haven't changed the API recently.

The entity is posted at the bottom. Seems like the controller can't deserialize byte arrays. When I removed 2 byte[] properties from my model, the error stopped.

With the byte[] properties included I have...

Operator Controller
[HttpGet]
public IEnumerable<OperatorEntity> GetAllOperators()
{
    var bl = GetBusinessLayer();
    var results = bl.GetAll(); //<=== This shows 18 rows with data
    return results;
}

Proxy
public async Task<T> ExecuteAsync<T>() where T : new()
{
    URL = client.BaseUrl + request.Resource;

<pre>
IRestResponse<T> restResponse = await client.ExecuteTaskAsync<T>(request, new CancellationToken());

var result = (T)restResponse.Data; // <===== NO DATA HERE

if (!string.IsNullOrEmpty(restResponse.ErrorMessage))

{
throw new Exception(restResponse.ErrorMessage); // <==== THROWS "No parameterless constructor defined for this object"
}
else
{
if ((int)restResponse.StatusCode >= 299)
{
string message = string.Format("An error occured calling the WebAPI. {0} The status code is '{1}'. {2} The error message is {3}",
Environment.NewLine, restResponse.StatusCode, Environment.NewLine, restResponse.Content);
throw new Exception(message);
}
}

return result;
}
Caller
public async Task<List<OperatorEntity>> GetAllOperatorsAsync()
{
    var webAPIExecutor = new WebAPIExecutor(ServerUrl, "/Operator/GetAllOperators/", Method.GET);
    return await webAPIExecutor.ExecuteAsync<List<OperatorEntity>>();
}
Entity
<pre>    [DataContract]
    [Serializable]
    public class OperatorEntity : _EntityBase
    {
        private bool _BuiltIn;
        [DataMember]
        public bool BuiltIn
        {
            get
            {
                return _BuiltIn;
            }
            set
            {
                if (_BuiltIn != value)
                {
                    _BuiltIn = value;
                    RaisePropertyChanged("BuiltIn");
                }
            }
        }

        private bool _Active;
        [DataMember]
        public bool Active
        {
            get
            {
                return _Active;
            }
            set
            {
                if (_Active != value)
                {
                    _Active = value;
                    RaisePropertyChanged("Active");
                }
            }
        }

        private string _FirstName;
        [DataMember]
        public string FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                if (_FirstName != value)
                {
                    _FirstName = value;
                    RaisePropertyChanged("FirstName");
                }
            }
        }

        private string _LastName;
        [DataMember]
        public string LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                if (_LastName != value)
                {
                    _LastName = value;
                    RaisePropertyChanged("LastName");
                }
            }
        }

        private string _Username;
        [DataMember]
        public string Username
        {
            get
            {
                return _Username;
            }
            set
            {
                if (_Username != value)
                {
                    _Username = value;
                    RaisePropertyChanged("Username");
                }
            }
        }

        private string _Password;
        [DataMember]
        public string Password
        {
            get
            {
                return _Password;
            }
            set
            {
                if (_Password != value)
                {
                    _Password = value;
                    RaisePropertyChanged("Password");
                }
            }
        }

        private DateTimeOffset? _PasswordChangedDate;
        [DataMember]
        public DateTimeOffset? PasswordChangedDate
        {
            get
            {
                return _PasswordChangedDate;
            }
            set
            {
                if (_PasswordChangedDate != value)
                {
                    _PasswordChangedDate = value;
                    RaisePropertyChanged("PasswordChangedDate");
                }
            }
        }

        private DateTimeOffset? _LastLoginDate;
        [DataMember]
        public DateTimeOffset? LastLoginDate
        {
            get
            {
                return _LastLoginDate;
            }
            set
            {
                if (_LastLoginDate != value)
                {
                    _LastLoginDate = value;
                    RaisePropertyChanged("LastLoginDate");
                }
            }
        }

        private byte[] _rowversion;
        [DataMember]
        public byte[] rowversion
        {
            get
            {
                return _rowversion;
            }
            set
            {
                if (_rowversion != value)
                {
                    _rowversion = value;
                    RaisePropertyChanged("rowversion");
                }
            }
        }

        private short _RoleType;
        [DataMember]
        public short RoleType
        {
            get
            {
                return _RoleType;
            }
            set
            {
                if (_RoleType != value)
                {
                    _RoleType = value;
                    RaisePropertyChanged("RoleType");
                }
            }
        }

        private byte[] _ESignature;
        [DataMember]
        public byte[] ESignature
        {
            get
            {
                return _ESignature;
            }
            set
            {
                if (_ESignature != value)
                {
                    _ESignature = value;
                    RaisePropertyChanged("ESignature");
                }
            }
        }

        private string _Email1;
        [DataMember]
        public string Email1
        {
            get
            {
                return _Email1;
            }
            set
            {
                if (_Email1 != value)
                {
                    _Email1 = value;
                    RaisePropertyChanged("Email1");
                }
            }
        }

        private string _Email2;
        [DataMember]
        public string Email2
        {
            get
            {
                return _Email2;
            }
            set
            {
                if (_Email2 != value)
                {
                    _Email2 = value;
                    RaisePropertyChanged("Email2");
                }
            }
        }

        private bool _SendAlerts;
        [DataMember]
        public bool SendAlerts
        {
            get
            {
                return _SendAlerts;
            }
            set
            {
                if (_SendAlerts != value)
                {
                    _SendAlerts = value;
                    RaisePropertyChanged("SendAlerts");
                }
            }
        }

        private short? _SendAlertsTime;
        [DataMember]
        public short? SendAlertsTime
        {
            get
            {
                return _SendAlertsTime;
            }
            set
            {
                if (_SendAlertsTime != value)
                {
                    _SendAlertsTime = value;
                    RaisePropertyChanged("SendAlertsTime");
                }
            }
        }

        private bool _SendResults;
        [DataMember]
        public bool SendResults
        {
            get
            {
                return _SendResults;
            }
            set
            {
                if (_SendResults != value)
                {
                    _SendResults = value;
                    RaisePropertyChanged("SendResults");
                }
            }
        }

        private short? _SendResultsTime;
        [DataMember]
        public short? SendResultsTime
        {
            get
            {
                return _SendResultsTime;
            }
            set
            {
                if (_SendResultsTime != value)
                {
                    _SendResultsTime = value;
                    RaisePropertyChanged("SendResultsTime");
                }
            }
        }

        private bool _MonitoringSystemUser;
        [DataMember]
        public bool MonitoringSystemUser
        {
            get
            {
                return _MonitoringSystemUser;
            }
            set
            {
                if (_MonitoringSystemUser != value)
                {
                    _MonitoringSystemUser = value;
                    RaisePropertyChanged("MonitoringSystemUser");
                }
            }
        }

        private bool _Email1AllowHtml;
        [DataMember]
        public bool Email1AllowHtml
        {
            get
            {
                return _Email1AllowHtml;
            }
            set
            {
                if (_Email1AllowHtml != value)
                {
                    _Email1AllowHtml = value;
                    RaisePropertyChanged("Email1AllowHtml");
                }
            }
        }

        private bool _Email2AllowHtml;
        [DataMember]
        public bool Email2AllowHtml
        {
            get
            {
                return _Email2AllowHtml;
            }
            set
            {
                if (_Email2AllowHtml != value)
                {
                    _Email2AllowHtml = value;
                    RaisePropertyChanged("Email2AllowHtml");
                }
            }
        }

        private bool _MonitoringSelf;
        [DataMember]
        public bool MonitoringSelf
        {
            get
            {
                return _MonitoringSelf;
            }
            set
            {
                if (_MonitoringSelf != value)
                {
                    _MonitoringSelf = value;
                    RaisePropertyChanged("MonitoringSelf");
                }
            }
        }

        private bool? _IsLockedOut;
        [DataMember]
        public bool? IsLockedOut
        {
            get
            {
                return _IsLockedOut;
            }
            set
            {
                if (_IsLockedOut != value)
                {
                    _IsLockedOut = value;
                    RaisePropertyChanged("IsLockedOut");
                }
            }
        }

        private bool? _IsActiveDirectory;
        [DataMember]
        public bool? IsActiveDirectory
        {
            get
            {
                return _IsActiveDirectory;
            }
            set
            {
                if (_IsActiveDirectory != value)
                {
                    _IsActiveDirectory = value;
                    RaisePropertyChanged("IsActiveDirectory");
                }
            }
        }
    }
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: ASP.Net MVC Serialization Problem - "No parameterless constructor defined for this object" Pin
Richard Deeming11-Feb-19 11:44
mveRichard Deeming11-Feb-19 11:44 
GeneralRe: ASP.Net MVC Serialization Problem - "No parameterless constructor defined for this object" Pin
Kevin Marois12-Feb-19 6:27
professionalKevin Marois12-Feb-19 6:27 
QuestionHow to send the 'Connection' header using HttpListenerResponse Pin
Shmuel Zang11-Feb-19 5:29
memberShmuel Zang11-Feb-19 5:29 
QuestionLocal IIS Development Question Pin
Kevin Marois7-Feb-19 11:07
professionalKevin Marois7-Feb-19 11:07 
AnswerRe: Local IIS Development Question Pin
Richard Deeming7-Feb-19 11:13
mveRichard Deeming7-Feb-19 11:13 
GeneralRe: Local IIS Development Question Pin
Kevin Marois7-Feb-19 11:37
professionalKevin Marois7-Feb-19 11:37 
GeneralRe: Local IIS Development Question Pin
Richard Deeming8-Feb-19 0:55
mveRichard Deeming8-Feb-19 0:55 
GeneralRe: Local IIS Development Question Pin
Kevin Marois11-Feb-19 5:26
professionalKevin Marois11-Feb-19 5:26 
GeneralRe: Local IIS Development Question Pin
Kevin Marois12-Mar-19 12:48
professionalKevin Marois12-Mar-19 12:48 
GeneralRe: Local IIS Development Question Pin
Richard Deeming13-Mar-19 1:33
mveRichard Deeming13-Mar-19 1:33 
GeneralRe: Local IIS Development Question Pin
Kevin Marois13-Mar-19 6:14
professionalKevin Marois13-Mar-19 6:14 
Question"The requested resource does not support http method 'GET" Pin
Kevin Marois7-Feb-19 10:05
professionalKevin Marois7-Feb-19 10:05 
AnswerRe: "The requested resource does not support http method 'GET" Pin
Richard Deeming7-Feb-19 10:28
mveRichard Deeming7-Feb-19 10:28 
GeneralRe: "The requested resource does not support http method 'GET" Pin
Kevin Marois7-Feb-19 11:05
professionalKevin Marois7-Feb-19 11:05 
QuestionAsp.Net MVC Delete Method Not Allowed Pin
Kevin Marois6-Feb-19 6:53
professionalKevin Marois6-Feb-19 6:53 
AnswerRe: Asp.Net MVC Delete Method Not Allowed Pin
Richard Deeming6-Feb-19 7:12
mveRichard Deeming6-Feb-19 7:12 
GeneralRe: Asp.Net MVC Delete Method Not Allowed Pin
Kevin Marois6-Feb-19 10:18
professionalKevin Marois6-Feb-19 10:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.