This is what ASP.NET does all the time. It looks for an ASPX page on the file system, compiles it, if required, and then processes the request.
Codebehind is optional. You can have a website with only ASPX in it, without any precompiled code.
Here's a ASPX page without codebehind
<%@ Page language="c#" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>ClearCache</title>
</HEAD>
<body>
<form id="ClearCache" method="post" runat="server">
<%
IList keys = new ArrayList(Cache.Count);
foreach (DictionaryEntry de in Cache)
keys.Add(de.Key);
foreach (string key in keys)
{
this.Response.Write(key + "<br>");
Cache.Remove(key);
}
%>
</form>
</body>
</HTML>
Downloading the file as html:
var wc = new WebClient();
wc.DownloadFile(myUrl, filename);
If you don't have a ASP.NET web-server, you have to start a server. Cassini is great for this. Then your code should look like this:
var server = new Server(80,"/", pathToWebSite);
server.Start();
var wc = new WebClient();
wc.DownloadFile(server.RootUrl + "myPage.aspx", filename);
server.Stop();
If you run this more than once, the server should be cached.
Note that you could also use a RuntimeHost as mentioned by code4life. Cassini does something similar. I'd give goth a try and see, what better fits your purpose.