Sylonious Posted April 27, 2003 Posted April 27, 2003 (edited) I've got my problem narrowed down to the Auth Login (in VB.Net). This is the only problem I am having. I can't figure out how to properly convert the the byte to base64 encoding (VB.Net) to send. Public Function Open() client.Connect(_server, _port) ns = client.GetStream() Dim strMessage As String = "HELO" & ControlChars.CrLf Dim sendBytes As [byte]() = Encoding.ASCII.GetBytes(strMessage) ns.Write(sendBytes, 0, sendBytes.Length) Dim StrMessage2 As String = "Auth Login" & ControlChars.CrLf Dim sendBytes2 As [byte]() = Encoding.ASCII.GetBytes(StrMessage2) ns.Write(sendBytes2, 0, sendBytes2.Length) Dim ConvertBytes3 ns = client.GetStream() Dim StrMessage3 As String = "User " & _Username & ControlChars.CrLf Dim sendBytes3 As [byte]() = (Encoding.ASCII.GetBytes(StrMessage3)) ConvertBytes3 = Convert.ToBase64String(sendBytes3) ns.Write(ConvertBytes3, 0, ConvertBytes3.Length) Dim ConvertBytes4 Dim StrMessage4 As String = "Pass " & _Username & ControlChars.CrLf Dim sendBytes4 As [byte]() = Encoding.ASCII.GetBytes(StrMessage4) ConvertBytes4 = Convert.ToBase64String(sendBytes4) ns.Write(ConvertBytes4, 0, ConvertBytes4.Length) End Function Edited April 27, 2003 by Sylonious Quote
*Gurus* Derek Stone Posted April 28, 2003 *Gurus* Posted April 28, 2003 Dim sBase64 As [msdn=System.String]String[/msdn] = [msdn=System.Convert]Convert[/msdn].ToBase64String(sendBytes4) ... should work just fine, assuming that sendBytes4 is not a null value. Quote Posting Guidelines
Sylonious Posted April 28, 2003 Author Posted April 28, 2003 My client.Getstream.Write does not work with strings. What do I use to write the response back to the server? This only wokred with Bytes. ns = client.GetStream() ns.Write(sBase64, 0, sBase64.Length) Quote
*Gurus* Derek Stone Posted April 28, 2003 *Gurus* Posted April 28, 2003 Convert the string to a byte array using the System.Text.Encoding.GetBytes method. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.