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 ......
<a>标签
1. <a href=”test.aspx”></a>
2. 这是最常见的一种转向方法;
HyperLink控件
1. Asp.net 服务器端控件 属性Naviga ......
问题1:
“/dsfsd”应用程序中的服务器错误。
未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源错误:
执 ......
Js代码
var url=Service.aspx?Value=' + escape(va);
obj=CreateAJAX();
if(obj)
& ......
对“添加”、“提交”、“保存”、“更新”等按钮需要对数据库进行写操作的按钮,一定要在页面初始化时加载脚本,防止多次重复点击,例如:
protected void Page_Load(object sender, EventArgs e)
{
//.net 2.0以上
......