Is there anyway to just make it ignore that member and and not serialize it, but serialize everything normally?
Main Topics
Browse All Topics I have a class for simplicity sake lets say that it has 2 Public properties with corresponding private fields. The first property is ImageUrl as String. The second property is Image as Bitmap. I have make the Image property with the NonSerialized() and Xml.Serialization.SoapIgno
The problem is that I still get the error that a Bitmap cannot be serialized when I try and view the webservice. So how can I serialize this class from the web server to the client (WinForms just so you know).
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I have the following
' Contains the bitmap image for this drill option.
<Xml.Serialization.SoapIgn
Public Property Image() As System.Drawing.Bitmap
Get
If _Image Is Nothing Then
Dim http As New System.Net.WebClient
Dim information() As Byte
information = http.DownloadData(_ImageUr
Dim stream As New System.IO.MemoryStream(inf
_Image = New System.Drawing.Bitmap(stre
End If
Return _Image
End Get
Set(ByVal Value As System.Drawing.Bitmap)
_Image = Value
End Set
End Property
Public Property ImageUrl() As String
Get
Return _ImageUrl
End Get
Set(ByVal Value As String)
_ImageUrl = Value
End Set
End Property
<NonSerialized(), Xml.Serialization.SoapIgno
Private _ImageUrl As String
OK I can do this and I get by this error.
Now I have another error. I'll increase the points if you can answer this one as well.
Another one of the fields in the class is of System.Type and now I get the following error message
The property 'MemberType' on type 'System.Reflection.MemberI
Any ideas on what I can do with this one. This time I do need the type, so I can't do the ImageUrl as string type of thing.
Never heard of that one, but I found a thread on it (although it doesn't sound like exactly the same problem)
http://www.dotnet247.com/2
Are you using an explicit permission attribute? If so, can you remove it.? If not, is the code in the property body doing something that requires special permissions?
Hmmm... from the Dotnet247 thread it would appear that Reflection is not allowed on items that have declarative security. The XML serializer uses Reflection, so that's probably why you're getting the error.
Grasping at straws: Can you do a .ToString() on the System.Type, expose the property as a string, and then reconstitute it as a type on the other end?
Business Accounts
Answer for Membership
by: wile_e_coyotePosted on 2004-02-05 at 08:52:12ID: 10281990
A couple of ideas
1. you can do your own serialization by implementing the IXmlSerializable interface. You can serialize the bitmap by converting it to a byte-array and writing it as a Base64 string.
2. you could use WSE (web service enhancements) to transfer the image as a file attachment. This would mean that the image probably could not be a member of your class.