问题描述
我有没有问题工作的的WebAPI。我已经在本地测试和部署到我的服务器并配置在IIS中此服务以使用基本身份验证。我能够浏览到我的服务,我收到认证挑战,我期待和所有工作顺顺当当!现在我想使用Fiddler来测试这一点,我已经建立了一个POST到特定的URL,我得到了一个401错误。所以我决定在我的请求头添加一个base64字符串,现在我得到一个500错误。
我想知道的是,我的请求头看起来是正确的呢?我显然会混淆我的主机和其中包含的用户名的格式字符串的base64:密码认证挑战
的User-Agent:提琴手
主持人:xxx.xxx.xxx.xxx:xxxx
内容长度:185
内容类型:text / JSON
授权:基本jskadjfhlksadjhdflkjhiu9813ryiu34
提琴手有一个工具,不会为Base64为您服务。只要创建你的字符串:用户名:密码,然后点击工具 - > TextWizard并输入用户名密码组合,选择ToBase64。复制并粘贴到您的授权头,你应该是好去。
I have a WebAPI that works without issue. I have tested locally and deployed to my server and configured this service in IIS to use Basic Authentication. I am able to browse to my service and I receive the Authentication challenge I expect and all works swimmingly! Now I want to use Fiddler to test this and I have constructed a POST to a specific url and I got a 401 (Unauthorized) error. So I decided to add a base64 string in my Request Header and I am now getting a 500 error.
What I would like to know is, does my Request Header look correct? I am obviously going to obfuscate my Host and base64 string which contains the format username:password for the Authentication challenge.
User-Agent: Fiddler
Host: xxx.xxx.xxx.xxx:xxxx
Content-Length: 185
Content-Type: text/json
Authorization: Basic jskadjfhlksadjhdflkjhiu9813ryiu34
Fiddler has a tool that does the Base64 for you. Just create your string: username:password and then go to Tools -> TextWizard and enter the username password combo and choose ToBase64. Copy and paste that into your Authorization header and you should be good to go.
这篇关于使用Fiddler使用基本身份验证来访问REST风格的WebAPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!