I use Cobra and I have built a webserver on the basis of WouterH’s classes (Link: Webserver extension for Fez Cobra/EMX )
I canrun a simple html file from Resources and the html is without styling and images. like as follow:
public static void Main()
{
using (HttpServer server = new HttpServer())
{
server.AddEvent("/", new HttpServer.EventCallback(index));
}
}
private static void html_test(object sender, HttpServer.EventCallbackEventArgs e)
{
e.Response = Resources.GetString(Resources.StringResources.index);
e.ResponseContentType = "text/html";
}
the html file is as follow:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>My first HTML document</title>
<script type="text/JavaScript">
<!--
function AutoRefresh(t) {
setTimeout("location.reload(true);", t);
}
// -->
</script>
</head>
<body onload="JavaScript:AutoRefresh(5000);">
<p>This page will refresh every 5 seconds.</p>
</body>
</html>
How can I add the external CSS file and images for html file? I haved tried to add a external CSS file and a image in the index.html, but after running the programm I can’t see the styling and image.
the changed the html is as follow, a index_styling.css and Koala.jpg are added in the resources.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css" href="index_styling.css" />
<title>My first HTML document</title>
<script type="text/JavaScript">
<!--
function AutoRefresh(t) {
setTimeout("location.reload(true);", t);
}
// -->
</script>
</head>
<body onload="JavaScript:AutoRefresh(5000);">
<p>This is some text. <img src="Koala.jpg" alt="Koala" width="32" height="32"> This is some text.</p>
<p>This page will refresh every 5 seconds.</p>
</body>
</html>
why I can’t see the styling and image after running programm? Can you help me?