asp.net页面静态化
方法一:
HtmlProxy.cs:
using System.Text;
using System.IO;
/// <summary>
/// HtmlProxy 的摘要说明
/// </summary>
public class HtmlProxy
{
public HtmlProxy()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static bool ChangeFile(int id)
{
string filename = HttpContext.Current.Server.MapPath("Post_" + id + ".html");
//尝试读取已有文件
Stream st = GetFileStream(filename);
//如果文件存在并且读取成功
if (st != null) //文件存在
{
using (st)
{
StreamToStream(st, HttpContext.Current.Response.OutputStream);
return true;
//Response.End();
}
}
Else //文件不存在,根据ForumDetail.aspx页面的内容创建文件
{
StringWriter sw = new StringWriter();
HttpContext.Curre
相关文档:
//以下代码根据别人文章和自己整理
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace WebApplication1
{
public partial class DownfFile : System.Web.UI.Page
{
p ......
在ASP.NET 1.1中,要做1个弹出的确认对话框的话,一般是在服务端的代码中这样写:
private void Page_Load(object sender, System.EventArgs e)
{
btnClick.Attributes.Add("onclick", "return confirm('Are you sure?');");
// Button1.Attributes["OnClick"] = "return conf ......
ASP.NET 数据控件:GridView,DataList,Repeater ,DetailsView,FormView。
ASP.NET 数据控件综述:
1.前3个用于呈现多条记录,后面2个用于呈现单条数据明细,即常用的记录明细。
2.GridView和DetailsView控件的布局固定,自定义数据显示的布局功能有限,一般适合布局简单的数据呈现。
3.DataList,Repeater和FormView数据 ......
<a>标签
1. <a href=”test.aspx”></a>
2. 这是最常见的一种转向方法;
HyperLink控件
1. Asp.net 服务器端控件 属性Naviga ......