Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem setting remoting URL from hardcoded string - appsettings works

Status
Not open for further replies.

PhilJohnson

IS-IT--Management
Apr 20, 2006
17
GB
I have a dll that uses Rocky Lhotka's CSLA. The CSLA relies on some settings in an app.config for remoting but my dll is not used by one of my apps so I have no control over the app.config.

The point where the string is set with the url of the remote object is:

string data = ConfigurationSettings.AppSettings["PortalServer"];

and the setting in app.config is:

<add key="PortalServer" value=" />

BUT when I change the initialization of the string to be hardcoded rather than from appsettings, like this:

string data = "
I get this error at the point the code tries to create the remote object:

"The Type System.Xml.XmlDocument in Assembly System.Xml, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 is not marked as serializable."

If I switch the line back to the original one getting the url from the appsettings, it all works again..... This is the only thing I am changing and it works every time from appsettings but never when I hardcode the string!

I have tried escaping the string and casting it to a string etc, like this:

string data = (string)@"
and every time, the string variable looks exactly the same as setting it from the appsettings but I get the error when the url is hardcoded.

This is a real showstopper for me, so I would really appreciate any help that anybody can give me.

I even emailed Rocky himself but he could not think of why it could be happening.

Thanks.

--
Regards,

Phil Johnson (MCAD)
 
It would seem to me that you are forgetting the quote characters on the beginning and end of the string because they are required after value= Saying string data = "SomeString" will not include the quotes but only sets SomeString as the value for the string. You need to add them in. That is all I can really think of. Tell me if this helps
 
Thanks for the response. I tried it but it did not seem to work unfortunately... good suggestion though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top