> That did not help. I wrote a sample program so that I can change the
> username, password, machine name, protection level impersonation at
[quoted text clipped - 104 lines]
>>>>> ProtectionLevel.EncryptAndSign
>>>>> Thanks
Here is what I have tried.
-- Client PC existing user account operating under account Brian
Visual Studio 2003 and 2005
OS:'XP Pro' Machine Name:'development' User Name:'Brian'
Password:'mypassword'
-- Server PC existing user account operating under account Brian
OS:'XP Pro' Machine Name:'dualtest' User Name:'Brian' Password:'mypassword'.
Visual Studio 2005.
Both machines operate outside of a domain behind a firewall and neither is a
virtual pc.
Listed below are the various NetworkCredential settings I have tried I
always get logged in a guest.
1.
- Client - NetworkCredential(@"Brian","mypassword", "development");
- Server - NetworkCredential(@"Brian","mypassword", "dualtest");
2.
- Client - NetworkCredential(@"Brian","mypassword", "dualtest");
- Server - NetworkCredential(@"Brian","mypassword", "dualtest");
3.
- Client - NetworkCredential(@"Brian","mypassword", "development");
- Server - NetworkCredential(@"Brian","mypassword", "development");
4.
- Client - NetworkCredential(@"Brian","mypassword", "dualtest");
- Server - NetworkCredential(@"Brian","mypassword", "development");
Anyway if I can't lick this one I'll try another approach. Thanks for you
help.
Brian
> Hi,
>
[quoted text clipped - 113 lines]
> >>>>> ProtectionLevel.EncryptAndSign
> >>>>> Thanks
Dominick Baier [DevelopMentor] - 10 Feb 2006 16:43 GMT
hi,
not sure whats wrong - this works for me
client:
....
negotiateStream = new NegotiateStream(client.GetStream());
// this is a valid account on the server machine
NetworkCredential cred = new NetworkCredential("user", "xxx",
"server");
negotiateStream.AuthenticateAsClient(cred, string.Empty);
if (negotiateStream.IsAuthenticated)
{
Console.WriteLine(
"IsAuthenticated: {0}",
negotiateStream.IsAuthenticated);
Console.WriteLine(
"IsMutuallyAuthenticated: {0}",
negotiateStream.IsMutuallyAuthenticated);
Console.WriteLine(
"IsEncrypted: {0}",
negotiateStream.IsEncrypted);
Console.WriteLine(
"IsSigned: {0}",
negotiateStream.IsSigned);
Console.WriteLine(
"IsServer: {0}",
negotiateStream.IsServer);
}
server:
TcpClient client = server.AcceptTcpClient();
Console.WriteLine("Connected!");
data = null;
// Get a stream object for reading and writing
// Wrap it in a NegotiateStream.
negotiateStream = new NegotiateStream(client.GetStream());
negotiateStream.AuthenticateAsServer();
if (negotiateStream.IsAuthenticated)
{
Console.WriteLine(
"IsAuthenticated: {0}",
negotiateStream.IsAuthenticated);
Console.WriteLine(
"IsMutuallyAuthenticated: {0}",
negotiateStream.IsMutuallyAuthenticated);
Console.WriteLine(
"IsEncrypted: {0}",
negotiateStream.IsEncrypted);
Console.WriteLine(
"IsSigned: {0}",
negotiateStream.IsSigned);
Console.WriteLine(
"IsServer: {0}",
negotiateStream.IsServer);
IIdentity remoteIdentity =
negotiateStream.RemoteIdentity;
Console.WriteLine(
"Client identity: {0}",
remoteIdentity.Name);
Console.WriteLine(
"Authentication Type: {0}",
remoteIdentity.AuthenticationType);
}
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
> Here is what I have tried.
>
[quoted text clipped - 137 lines]
>>>>>>> ProtectionLevel.EncryptAndSign
>>>>>>> Thanks