المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : (NegotiateStream) The server has rejected the client credentials



C# Programming
12-03-2009, 07:23 AM
I've followed the following tutorial: http://msdn.microsoft.com/en-us/library/system.net.security.negotiatestream%28VS.80%29.aspx[^ (http://msdn.microsoft.com/en-us/library/system.net.security.negotiatestream%28VS.80%29.aspx)]

and have implemented a server and client application. http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif


When I use the client to connect to the server on the same machine (i.e. the IP is 127.0.0.1) it makes a secure connection. http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif

When I use the client on my XP machine to connect to the server on my Vista machine then the line:

authStream.EndAuthenticateAsServer(ar);

fails with the exception I pasted into the subject of this post. http://www.barakasoft.com/script/Forums/Images/smiley_frown.gif

What I want to do is allow any client on any machine over the internet or LAN to connect to my server on port 9000.
I would be happy if I could allow the client to specify a username and password - but I don't know how to implement that functionality.


details on the exception:

$exception
- $exception {"The server has rejected the client credentials."} System.Exception {System.Security.Authentication.InvalidCredentialException}
+ [System.Security.Authentication.InvalidCredentialException] {"The server has rejected the client credentials."} System.Security.Authentication.InvalidCredentialException
+ Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
HelpLink null string
+ InnerException {"The logon attempt failed"} System.Exception {System.ComponentModel.Win32Exception}
Message "The server has rejected the client credentials." string
Source "System" string
StackTrace " at System.Net.Security.NegoState.EndProcessAuthentication(IAsyncResult result)\r\n at System.Net.Security.NegotiateStream.EndAuthenticateAsServer(IAsyncResult asyncResult)\r\n at RemoteDiagnostics.Server.class_RDServer.EndAuthenticateCallback(IAsyncResult ar) in C:\\Users\\Nuclear\\Documents\\Visual Studio 2008\\Projects\\RemoteDiagnostics\\RemoteDiagnostics\\Server\\class_RDServer.cs:line 280" string
+ TargetSite {Void EndProcessAuthentication(System.IAsyncResult)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}


authStream
- authStream {System.Net.Security.NegotiateStream} System.Net.Security.NegotiateStream
+ base {System.Net.Security.NegotiateStream} System.Net.Security.AuthenticatedStream {System.Net.Security.NegotiateStream}
CanRead false bool
CanSeek false bool
CanTimeout true bool
CanWrite false bool
+ ImpersonationLevel 'authStream.ImpersonationLevel' threw an exception of type 'System.Security.Authentication.InvalidCredentialException' System.Security.Principal.TokenImpersonationLevel {System.Security.Authentication.InvalidCredentialException}
IsAuthenticated false bool
IsEncrypted false bool
IsMutuallyAuthenticated false bool
IsServer true bool
IsSigned false bool
+ Length 'authStream.Length' threw an exception of type 'System.NotSupportedException' long {System.NotSupportedException}
+ Position 'authStream.Position' threw an exception of type 'System.NotSupportedException' long {System.NotSupportedException}
ReadTimeout -1 int
+ RemoteIdentity 'authStream.RemoteIdentity' threw an exception of type 'System.Security.Authentication.InvalidCredentialException' System.Security.Principal.IIdentity {System.Security.Authentication.InvalidCredentialException}
WriteTimeout -1 int