I'm using .net WebApi to expose different endpoints with JSON data. Now I need that an specific endpoint returns HTMLs pages. I have implemented it like this.
[HttpGet]
[Route("htmlPage/{htmlPageId}")]
public HttpResponseMessage GetHtmlPage(string htmlPageId) {
string rawHtml = m_logic.GetHtmlPageById(htmlPageId);
HttpResponseMessage response = new HttpResponseMessage {Content = new StringContent(rawHtml)};
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
return response;
}
The problem that I'm facing is when that HTML page have some images. I don't know how to expose them because now I'm getting a 404 not found error when I call my endpoint from my browser. I have a folder in my project with these images and some Javascript scripts that I must return.
How can I do this?
EDIT: This is part of my HTML
<html lang=\"en\">
<head>
<title> Simplest HTML </title>
<meta name=\"description\" content=\"The Html served\">
<meta name=\"author\" content=\"acostela\">
<script type="text/javascript" src="./public/scripts/my-api.js"></script>
</head>
<body>
<h1> The first Simplest html served!!</h1>
<img src="./public/img/success.jpg"/></br></br>
</body>
</html>
My folder structure is the following
-->Html
|
|
---> myFirstHtml.html
|
|
---> public
|
|
---> img
| |
| |
| ---> success.jpg
|
|
---> scripts
|
|
---> my-api.js
