0
다른 thirdy party API로 푸시하기 위해 JSON을 수락하는 ASP.NET WebAPI 끝점이 있습니다. 아래처럼 JSON 값으로 HTML을 게시하는 데 문제가 있습니다.HTML 코드를 JSON 값으로 게시 할 때 403 오류가 발생했습니다.
var attr1 = {};
attr1.attributeid = 1234;
attr1.attributevalue = '<div>test</div>';
output.attributes.push(attr1);
결과는 HTTP 403 오류입니다. JSON으로 일반 문자열을 밀어 때
그러나, 그것은 HTTP WebAPI 백엔드는 .NET 4.6.2에 200
var attr1 = {};
attr1.attributeid = 1234;
attr1.attributevalue = 'test';
output.attributes.push(attr1);
, 작품의 OAuth 2.0은 무기명 모든 요청 토큰이 필요합니다. 참고 다른 일들이, CORS가 활성화되고 API 컨트롤러 액션은 다음과 같습니다
public async Task<IHttpActionResult> Post([FromBody] Email email)
{
var emailResult = new Email();
try
{
using (var svc = new EmailService())
{
emailResult = await svc.SendTransactionalEmail(email);
}
if (emailResult != null)
{
if (emailResult.Success)
{
return Ok("Transactional email successfully sent!");
}
else
{
return BadRequest(emailResult.Result);
}
}
else
{
return BadRequest();
}
}
catch (Exception e)
{
return InternalServerError(e);
}
}