From: Eric on
Hi,

I was under the impression that with serialization I could transfer a block
of data from one application to another.
So I wrote a website where after the user had put in some data, it is put in
a structure and that structure is serialized into a file.

Then this file is emailed and the backend user reads it in an application
for processing.

If I try to read the file into the same kind of structure, I get an
exception error.
Apparently it needs the webpage that generated the file to open it???

This is putting me in a lot of trouble as the website is already in use.

Is there a way to read the data from the files without the assembly that
created it?

Please help me with this!!

rg,
Eric

From: Cor Ligthert[MVP] on
Probably Yes,

Create in the receiving code, the same class description as in the sending
one, and use that to deserialize as the type.

Otherwise serialize to XML and send the scheme included.



"Eric" <Eric(a)discussions.microsoft.com> wrote in message
news:A5C98E7D-8FE4-45B1-8459-5AC9074B36A1(a)microsoft.com...
> Hi,
>
> I was under the impression that with serialization I could transfer a
> block
> of data from one application to another.
> So I wrote a website where after the user had put in some data, it is put
> in
> a structure and that structure is serialized into a file.
>
> Then this file is emailed and the backend user reads it in an application
> for processing.
>
> If I try to read the file into the same kind of structure, I get an
> exception error.
> Apparently it needs the webpage that generated the file to open it???
>
> This is putting me in a lot of trouble as the website is already in use.
>
> Is there a way to read the data from the files without the assembly that
> created it?
>
> Please help me with this!!
>
> rg,
> Eric
>
From: Phill W. on
On 27/05/2010 23:03, Eric wrote:

> I was under the impression that with serialization I could transfer a block
> of data from one application to another.

Sometimes.

> So I wrote a website where after the user had put in some data, it is put in
> a structure and that structure is serialized into a file.
> Then this file is emailed and the backend user reads it in an application
> for processing.
> If I try to read the file into the same kind of structure, I get an
> exception error.

That will be because the Type that was created and serialised is
/different/ from the Type into which you're trying to deserialise it.

Even if you cut and paste the code from one project to the other, it
will [almost certainly] not work. A Type defined within one project is
/different/ from a Type defined in any other project, even if it looks
the identical to the named eye.

You need to extract this class into a common library (.dll) and
reference this library from both projects (and preferably with the
library in the Global Assembly Cache, if you can).

That's the /only/ reliable way I've got anything like this to work.

HTH,
Phill W.