How to serialize and object to use as a parameter in a URL?

  • Thread starter Thread starter Julia
  • Start date Start date
J

Julia

Hi,

I need to serialize an object in such a way that it can be passed as
parameter in a URL

http://www.domain.com?object=%d793btng....

I did some reading and I came to the conclusion that I need to create a
custom formatter and implements the IFormatter interface

the problem is that I don't quit know how to implements the
IFormatter.Serialize function

1.How do I get the attribute of each property?

2.How can i get all properties,i guess I need to use reflection?

2.How do I track the object which already Serialized(assuming the object
contains other objects)

Note that I cannot use binary formatter or other,since the code which do the
deserialization is a client side java script

thanks in advance.
 
Why?!?!

Kevin Spencer said:
Keep the QueryString under 255 characters...

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

Julia said:
Thanks,i must use the URL since i am passing it using email
I am using Base64 to encode the output.


Thanks.


message news:[email protected]...
Additionally, you would have to encode the output to account for
characters that are not allowed.

Personally, I would choose to use the SOAP formatter and then use
a
POST
to post the contents to the server. The output of any object being
serialized is quite lengthy, and not suited for placement in a URL.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi Julia:

Reflection would allow you to step through the public properties of
any object. The PropertyInfo class in the System.Reflection namespace
is pretty useful for getting the values of all properties:

PropertyInfo[] info = Type.GetType("System.Type").GetProperties();

Then use GetValue on each PropertyInfo to return the value of each
property as an object..

HTH,

--
Scott
http://www.OdeToCode.com


Hi,

I need to serialize an object in such a way that it can be passed as
parameter in a URL

http://www.domain.com?object=%d793btng....

I did some reading and I came to the conclusion that I need to
create
which
 
Back
Top