HighTechTalks DotNet Forums  

Help Needed..dotnet remoting security issue

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss Help Needed..dotnet remoting security issue in the Dotnet Framework (Remoting) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
sumu
 
Posts: n/a

Default Help Needed..dotnet remoting security issue - 03-08-2007 , 04:45 AM






Hello,

I am trying to develop a dot net client server application.My
application works perfects on LAN..The problem arised when i tried to
host the remote object in a webserver.
The error i get is
" Type System.DelegateSerializationHolder and the types derived from
it (such as System.DelegateSerializationHolder) are not permitted to
be deserialized at this security level."
I am aware of the security issue in dotnet and am using
typefilterlevel.Full in both server and client.
I will paste my code for your reference

//code in server

public string StartHttpServer()
{
HttpChannel chnl;
retmsg="ok";
try
{
BinaryServerFormatterSinkProvider ServProv=new
BinaryServerFormatterSinkProvider();
ServProv.TypeFilterLevel=System.Runtime.Serializat ion.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider ClientProv=new
BinaryClientFormatterSinkProvider();
IDictionary props=new Hashtable();
props["port"]=4444;
props["typeFilterLevel"] = "Full";
chnl=new HttpChannel(props,ClientProv,ServProv);
ChannelServices.RegisterChannel(chnl);
RemotingConfiguration.RegisterWellKnownServiceType (typeof(Remoting.Remotableobject),"Remotableobject .rem",WellKnownObjectMode.Singleton);
props.Clear();
props=null;
}
catch(Exception ex)
{
retmsg=ex.Message;
}
return retmsg;
}

//Code in Client


public ChatCenter(callbackclass callbackobj,Remotableobject
remfromLogin)
{
callback=callbackobj;
rem=remfromLogin;

IDictionary props=new Hashtable();
BinaryServerFormatterSinkProvider serv=new
BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider cl=new
BinaryClientFormatterSinkProvider();
serv.TypeFilterLevel=System.Runtime.Serialization. Formatters.TypeFilterLevel.Full;

props["typeFilterLevel"] = TypeFilterLevel.Full;
props["port"]=0;

chnl=new HttpChannel(props,cl,serv);
ChannelServices.RegisterChannel(chnl);
props.Clear();
props=null;
try
{
rem= (Remoting.Remotableobject)
Activator.GetObject(typeof(Remoting.Remotableobjec t),server);

//Here the remote object returns the server ip without any problem.
MessageBox.Show(rem.checkConnectivity());

//The error is thrown from this statement
rem.eventRxText+=new ReceieveText(callback.rem_eventRxText);
rem.eventGtUsers+=new getusers(callback.rem_eventGtUsers);

}
catch(Exception ex)
{
MessageBox.Show(null,ex.Message,"Unable to reach
server",MessageBoxButtons.OK,MessageBoxIcon.Exclam ation);
System.IO.StreamWriter sr=new System.IO.StreamWriter(@"E:\dotnet\c#
\RemoteClient\log.htm",true);
sr.Write(ex.Message);
sr.Close();
}
}


Please somebody help me..
I am struggleing with this for one week.

Thanks in Advance


Reply With Quote
  #2  
Old   
Vertygo
 
Posts: n/a

Default Re: Help Needed..dotnet remoting security issue - 03-09-2007 , 10:47 AM






Here is my example that works:

Server:

BinaryClientFormatterSinkProvider clientProvider = new
BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverProvider = new
BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilter Level.Full;

ht["name"] = string.Empty;
ht["port"] = 9000;
ht.Add("typeFilterLevel",
System.Runtime.Serialization.Formatters.TypeFilter Level.Full);

TcpChannel channel = new TcpChannel(ht, clientProvider,
serverProvider);
ChannelServices.RegisterChannel(channel);

string identifier = "Downloader";
WellKnownObjectMode mode = WellKnownObjectMode.Singleton;

WellKnownServiceTypeEntry entry = new
WellKnownServiceTypeEntry(typeof(ServerTalk),
identifier, mode);
RemotingConfiguration.RegisterWellKnownServiceType (entry);

Client:

BinaryClientFormatterSinkProvider clientProvider = new
BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverProvider = new
BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilter Level.Full;
TcpChannel channel;
RemotingConfiguration.CustomErrorsEnabled(false);
System.Collections.IDictionary oChannelProperties = new
System.Collections.Hashtable();
oChannelProperties.Add("name", string.Empty);
oChannelProperties.Add("port", 0);
oChannelProperties.Add("typeFilterLevel",
System.Runtime.Serialization.Formatters.TypeFilter Level.Full);

channel = new TcpChannel(oChannelProperties,
clientProvider, serverProvider);

RemotingConfiguration.CustomErrorsEnabled(false);
if(RemotingConfiguration.CustomErrorsMode !=
CustomErrorsModes.Off)
RemotingConfiguration.CustomErrorsMode =
CustomErrorsModes.Off;


System.Runtime.Remoting.Channels.ChannelServices.R egisterChannel(channel,
false);


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.