Dim result = New JavaScriptSerializer().Deserialize(Of SearchResult)(Request.Cookies.Get("user").Value)
An exception of type 'System.MissingMethodException' occurred in System.Web.Extensions.dll but was not handled in user code
Additional information: No parameterless constructor defined for type of 'System.DirectoryServices.SearchResult'.
I see there have been many questions regarding this issue, but the required object types were self-defined class, so the solution would be to create a new and parameterless constructor for that class.
In my case, I am trying to use SearchResult from namespace System.DirectoryServices as the object type to be deserialized from JSON String. How can I solve it?
You can't deserialise a
SearchResultobject because it has no public constructor.In theory you could write a
JavaScriptConverterand use reflection to instantiate an instance of the target class in the convertor'sDeserialize()method but that would be hackery of the first order.Either serialize and deserialize a custom class of your own making, or rethink what you're doing.