I need to validate a basic authorization header that is being sent to my HttpListener in VB.NET. I'm grabbing the header like so (feel free to point out better ways to do this as well):
EncodedAuth = Context.Request.Headers.GetValues("Authorization")(1)
Now how do I decode them? I understand the theory but I can't seem to find the right code.
Thank you.
This should do it...
basicData = System.Text.ASCIIEncoding.ASCII.GetString( System.Convert.FromBase64String( EncodedAuth ) )
This will give you a string in the format "username:password". Split the string on ":" and you'll get the credentials.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With