Navigation
Links

Powered by Squarespace
« CountryWide PayPlan/52 | Main | Is it reference or value equality? »
Monday
Sep062004

IPAddress class serializable?

Back in 2002 I posted a question in Usenet about the IPAddress class being serializable, but not serializing in ASP.NET. I just found the post, and noticed that no one responded with the reason why. So, here it is:

There are two types of serialization in .NET: System.Runtime.Serialization and System.Xml.Serialization. Runtime serialization uses the serializable attribute while XML serialization does not. Since ASP.NET uses XML serialization, the attribute was irrelevant.

The error I received was:

System.Net.IPAddress cannot be serialized because it does not have a default public constructor

One of the requirements of the XmlSerializer is that the class it is trying to serialize must have a default public constructor.

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.

Reader Comments (9)

You should crosspost this to the newsgroup. Remember, Google is forever. ;-)

September 8, 2004 | Unregistered CommenterDavid Collantes

So is george.tsiokos.com. :)

September 8, 2004 | Unregistered CommenterGeorge Tsiokos

I will come five years from now and we'll talk.

September 13, 2004 | Unregistered CommenterDavid Collantes

Ok, so now it's April of 2009 and you still can't serialize an IPAddress with XmlSerializer. Now what?

April 3, 2009 | Unregistered CommenterAl Dunstan

Well, its almost 5 years after your posting and its still here.

June 30, 2009 | Unregistered CommenterJason Jackson

So? Did he show? Was there a talk?
8 D

November 23, 2009 | Unregistered CommenterJ West

5 years later...

December 9, 2009 | Unregistered CommenterNick

Nice! You had posted the same on USENET after all, two years before this weblog entry (unless, of course, the dates here are wrong).

December 15, 2009 | Unregistered CommenterDavid Collantes

Ran into this problem too and would love a solution.

February 11, 2010 | Unregistered CommenterMatt Dunlap

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>