If you cannot generate static pages for the whole site, but you can generate static pages for the homepage, as long as there are just a few linesCodeYou can do it. In this way, at least the homepage of your website is much faster to load, without the direct code:
Protected override void render (htmltextwriter writer)
{
String filename = ""
+ Datetime. Now. Year
+ Datetime. Now. Month
+ Datetime. Now. Day
+ Datetime. Now. Hour
+ Datetime. Now. Minute
+ Datetime. Now. Second
+ Datetime. Now. millisecond + ". htm ";
Try
{
String newpath = server. mappath (".") + "\" + filename;
// String newpath = server. mappath ("newfile") + "\" + filename;
Filestream FS = file. Create (newpath );
FS. Close ();
// File. Create (server. mappath ("newfile") + "\" + filename );
Streamwriter r = new streamwriter (newpath, false, system. Text. encoding. utf8 );
Htmltextwriter H = new htmltextwriter (R );
Base. Render (h );
Response. Redirect (newpath );
r. close ();
H. close ();
}< br> catch (Exception error)
{< br> throw error;
}< BR >}