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.
From stackoverflow
-
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.
Ryan : Just what I was looking for, thanks.
0 comments:
Post a Comment