Пример #1
0
        private IActionResult ResponseWithExceptionReport(string exceptionCode, string message, string locator)
        {
            var xmlDoc = new ExceptionReport(exceptionCode, message, locator).ToXml();

            Response.ContentType = MediaTypeNames.Application.Xml;
            Response.StatusCode  = (int)HttpStatusCode.OK;
            return(File(xmlDoc.ToUTF8ByteArray(), Response.ContentType));
        }
Пример #2
0
        private IActionResult ResponseWithNotFoundError(string exceptionCode, string message)
        {
            var xmlDoc = new ExceptionReport(exceptionCode, message).ToXml();

            Response.ContentType = MediaTypeNames.Text.Xml + "; charset=utf-8"; // TODO: better way?
            Response.StatusCode  = (int)HttpStatusCode.NotFound;
            // TODO: content-disposition: filename="message.xml"
            return(File(xmlDoc.ToUTF8ByteArray(), Response.ContentType));
        }