Rya*_*yan 5 vb.net authorization httplistener
我需要验证在VB.NET中发送到我的HttpListener的基本授权标头.我这样抓住标题(随意指出更好的方法来做到这一点):
EncodedAuth = Context.Request.Headers.GetValues("Authorization")(1)
Run Code Online (Sandbox Code Playgroud)
现在我如何解码它们?我理解这个理论,但我似乎找不到合适的代码.
谢谢.
这应该做到......
basicData = System.Text.ASCIIEncoding.ASCII.GetString( System.Convert.FromBase64String( EncodedAuth ) )
Run Code Online (Sandbox Code Playgroud)
这将为您提供"username:password"格式的字符串.将字符串拆分为":",您将获得凭据.
| 归档时间: |
|
| 查看次数: |
2736 次 |
| 最近记录: |