Tag: 邮递员

尝试使用Content-Type application / x-www-form-urlencoded来访问API

我正在使用dotnet核心框架构建API restful服务器。 我添加了我的控制器并尝试使用邮递员到达终端。 我有2个问题 问题1 // POST api/user [HttpPost] [Authorize()] public async Task Post([FromBody]UserModel user) { } 除非我通过键入raw json从postman发送请求作为application/json ,否则如果我使用application/x-www-form-urlencoded而无法访问此端点,那么我总是得到415不支持的媒体类型 问题2 // POST api/user/avatar [HttpPost] [Authorize()] [Route(“avatar”)] public async Task Post([FromBody]UserModel user, [FromBody]IFormFile file) { } 我不知道如何使用邮递员达到这样的终点

azure移动服务活动目录身份validationX-ZUMO-AUTH令牌在注销后在邮递员中有效

我有Azure Mobile Service和AD设置进行身份validation。 通过移动应用程序注销并登录完美。 AD应用程序回复url为https://test.azure-mobile.net/signin-aad client = new MobileServiceClient (applicationURL, applicationKey); var authResult = await client.LoginAsync(this, MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory); var data = await client.InvokeApiAsync(“testAPI”, HttpMethod.Get, null); //Works client.Logout(); // LOGOUT var data = await client.InvokeApiAsync(“testAPI”, HttpMethod.Get, null); //Unauthorized Error at mobile side. Request not going to API 这项工作是完美的。 但是如果我在LOGOUT之后从authResult复制令牌,我可以使用相同的令牌从邮递员调用API。 标题:X-ZUMO-AUTH→令牌 我如何validation令牌? Azure移动服务端需要进行任何设置来validation和阻止此操作吗?

使用Postman进行ASP.NET Web API授权

我创建了一个ASP.NET Web API并将Authorize属性应用于API控制器。 现在,我想使用Postman测试它,但我收到了授权错误。 控制器代码是: [Authorize] [HttpPost] public IHttpActionResult Attend([FromBody] int gigId) { var attendance = new Attdendance { GigId = gigId, AttendeeId = User.Identity.GetUserId() }; _context.Attdendances.Add(attendance); _context.SaveChanges(); return Ok(); } 我的请求看起来像http://prntscr.com/c8wz0b 我正在使用这个先进的Postmanrest客户端http://prntscr.com/c8xafd 我如何通过Postman授权?

使用Postman上传ASP核心WebApi测试文件

我创建了一个采用任意文件的端点: [HttpPost()] public async Task CreateFile(IFormFile file) 当我使用Postman测试它时,该file始终为null。 这是我在邮差中所做的事情: 我究竟做错了什么?