I have an asmx method that accepts the list of files such as:
[WebMethod] Public Zero UploadFiles (list & lt; byte [] & gt; Files) {} The Windows metadata is not included in the byte array I have the dictionary & lt; Filename, byte []> Tried to use but the classes that implement IDictionary are not serialized, I KeyValuePair & lt; String, byte [] & gt; Trying to use [] but the IMO looks dirty What are other ways to include the name of the file?
As noted in the comments, it can be easily solved by creating a custom data class Gaya.
It is unfortunate that dictionary serials are not eligible, but this is an inherent flaw in the XML serialization process. Data is also known for quantity related references, it does not work.
WCF, however, has been able to fix those issues. But you're using .asmx (SOAP), so you're going through unfortunate inconsistencies.
I will just create a custom square:
[serializable] public class file {public string filename {get; Set;} public byte [] payload {get; Set;}} Then change your web method to:
[WebMethod] Public Zero UploadFiles (list & file; files & gt; files) {// ...} Simple, but effective :)
No comments:
Post a Comment