Home All Groups Group Topic Archive Search About

XmlSerialization of classes with declarative Security

Author
26 Feb 2005 7:05 PM
Doug Holland
I'm working on a project where I have to pass a serialized object to a
ASP.NET web service and I recieve an exception because that the object cannot
be serialized due to declarative security.

The object in question is an Exception class and as such I cannot change the
declarative security to imperative security permissions or demans in property
accessors because I do not own the code to the Exception class.

The following support article details how to do this in this way.

http://support.microsoft.com/?kbid=326971

Is there a way that I can allow a WebMethod to take an Exception as a
parameter and not recieve the security exception that results from attempting
to serialize a class with declarative security?

Thanks in advance

Doug Holland

Author
1 Mar 2005 6:25 PM
Nicole Calinoiu
Not directly, but there are other ways to pass exception information to a
web method.  One easy approach would be to pass just the type and message.
A more complex approach would be to use an alternate serializer such as the
BinaryFormatter, then pass the serialized data as, for example, a byte
array.



Show quoteHide quote
"Doug Holland" <DougHoll***@discussions.microsoft.com> wrote in message
news:B99CB991-2395-4577-9AE6-64EFB29C932E@microsoft.com...
> I'm working on a project where I have to pass a serialized object to a
> ASP.NET web service and I recieve an exception because that the object
> cannot
> be serialized due to declarative security.
>
> The object in question is an Exception class and as such I cannot change
> the
> declarative security to imperative security permissions or demans in
> property
> accessors because I do not own the code to the Exception class.
>
> The following support article details how to do this in this way.
>
> http://support.microsoft.com/?kbid=326971
>
> Is there a way that I can allow a WebMethod to take an Exception as a
> parameter and not recieve the security exception that results from
> attempting
> to serialize a class with declarative security?
>
> Thanks in advance
>
> Doug Holland