Help - Remoting
-
Hi.. I am using the following code for my remoting example. When I use MarshalByRefObject it works fine.
using System; namespace ns_application { namespace ns_authentication { public class cls_registeruser : MarshalByRefObject { private string _username; public cls_registeruser(string username) { _username = username; Console.WriteLine("Registered User :" + _username); } public cls_registeruser() { _username = "NULL"; Console.WriteLine("Username is " + _username); } ~cls_registeruser() { Console.WriteLine("User deleted" + _username); } public string username { get{return _username;} } } } }
But when I try to use [Serializable] it shows error "Trying to create a proxy to an unbound type".using System; namespace ns_application { namespace ns_authentication { [Serializable] public class cls_registeruser { private string _username; public cls_registeruser(string username) { _username = username; Console.WriteLine("Registered User :" + _username); } public cls_registeruser() { _username = "NULL"; Console.WriteLine("Username is " + _username); } ~cls_registeruser() { Console.WriteLine("User deleted" + _username); } public string username { get{return _username;} } } } }
As far as I know : "MarshalByRefObject" will give me a reference to an object created on the server. All the execution will take place on the server. "Serializable" will send to me the object state, and the execution will be done at the client machine itself. But at some places I see the following usage :[Serializable] public class_name : MarshalByRefObject
What does this mean? Also, if [Serializable] is there, what is the use of "ISerializable" interface. Waiting for responses guyz... I have googled a lot already but am not getting a clear picture. -
Hi.. I am using the following code for my remoting example. When I use MarshalByRefObject it works fine.
using System; namespace ns_application { namespace ns_authentication { public class cls_registeruser : MarshalByRefObject { private string _username; public cls_registeruser(string username) { _username = username; Console.WriteLine("Registered User :" + _username); } public cls_registeruser() { _username = "NULL"; Console.WriteLine("Username is " + _username); } ~cls_registeruser() { Console.WriteLine("User deleted" + _username); } public string username { get{return _username;} } } } }
But when I try to use [Serializable] it shows error "Trying to create a proxy to an unbound type".using System; namespace ns_application { namespace ns_authentication { [Serializable] public class cls_registeruser { private string _username; public cls_registeruser(string username) { _username = username; Console.WriteLine("Registered User :" + _username); } public cls_registeruser() { _username = "NULL"; Console.WriteLine("Username is " + _username); } ~cls_registeruser() { Console.WriteLine("User deleted" + _username); } public string username { get{return _username;} } } } }
As far as I know : "MarshalByRefObject" will give me a reference to an object created on the server. All the execution will take place on the server. "Serializable" will send to me the object state, and the execution will be done at the client machine itself. But at some places I see the following usage :[Serializable] public class_name : MarshalByRefObject
What does this mean? Also, if [Serializable] is there, what is the use of "ISerializable" interface. Waiting for responses guyz... I have googled a lot already but am not getting a clear picture.is it anyhow related to ASP.NET :confused::confused:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
is it anyhow related to ASP.NET :confused::confused:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.