Home All Groups Group Topic Archive Search About

remoting in 2.0 and credentials

Author
11 May 2006 7:48 AM
Mathias Fritsch
I can access a remote object that is hostet on my own machine in IIS if
I
supply default credentials.
If I supply the same account data explicitly I run into a 401.

Is there something wrong?

--------------------------------------------------
            IRemotingFacade remFacade;
            string result = string.Empty;
            BinaryServerFormatterSinkProvider serverProvider = new
BinaryServerFormatterSinkProvider();
            serverProvider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            BinaryClientFormatterSinkProvider clientProvider = new
BinaryClientFormatterSinkProvider();


            Hashtable props = new Hashtable();
            props.Add("port", 0);


//this works
            props.Add("useDefaultCredentials", true);


                // 1. doesnt work if useDefaultCredentials is set to
false
            //ICredentials login = new NetworkCredential("mfritsch",
"mypassword", "mydomain");
            //props.Add("credentials", login);


                // 2. doesnt work
            //props.Add("UserName", "mfritsch");
            //props.Add("Password","myPassword")
            //props.Add("Domain", "mydomain");

            HttpChannel channel = new HttpChannel(props,
clientProvider, serverProvider);

            ChannelServices.RegisterChannel(channel);

            remFacade =
(IRemotingFacade)Activator.GetObject(typeof(IRemotingFacade),
"http://localhost/RemotingServer/RemotingType.rem");

            object result = remFacade.SaveData(myData );
            ChannelServices.UnregisterChannel(channel);

--------------------------------------------------
regards
Mathias

AddThis Social Bookmark Button