Remoting Authentification

T

teddy

Hello! I have HttpChannel (client server) and I want to authenticate users
(username and password, specified not by system, but myself). Can you help
me please? Thanks a lot

My connection codes:
Server:
IDictionary props = new Hashtable();

props["typeFilterLevel"] = "Full";

ListDictionary channelProperties = new ListDictionary();

channelProperties.Add("port", 1185);

channelProperties.Add("secure", true);

channelProperties.Add("impersonate", true);

props["useDefaultCredentials"] = false;

HttpChannel chan = new HttpChannel(channelProperties,

new SoapClientFormatterSinkProvider(),

new SoapServerFormatterSinkProvider(props, null));

m_objActSrv = (RemObj)Activator.GetObject(

typeof(RemObj),

"http://localhost:1185/WTRemoteServer");

if(ChannelServices.GetChannel(chan.ToString()) == null )

ChannelServices.RegisterChannel(chan);

RemotingConfiguration.RegisterWellKnownServiceType(

typeof(RemObj),

"WTRemoteServer", WellKnownObjectMode.Singleton);



Client:

channelProperties = new ListDictionary();

channelProperties.Add("name", string.Empty);

channelProperties.Add("port", 0);

channelProperties.Add("secure", true);

channelProperties.Add("connectionTimeout", 5000);

IDictionary props = new Hashtable();

props["typeFilterLevel"] = "Full";

props["useDefaultCredentials"] = false;

NetworkCredential credentials = new NetworkCredential("usernamevr",
"passwordpass");

HttpChannel chan = new HttpChannel(channelProperties,

new SoapClientFormatterSinkProvider(),

new SoapServerFormatterSinkProvider(props,null));

if(ChannelServices.GetChannel(chan.ToString()) == null )

ChannelServices.RegisterChannel(chan);

registedChan = chan;

string url = String.Format("http://{0}:{1}/WTRemoteServer", ip, port);

ISrvObj = (RemObj) (Activator.GetObject(typeof(RemObj), url));

ChannelServices.GetChannelSinkProperties(ISrvObj)["credentials"]=credentials
;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top