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
相关文档:
为每个用户存储配置信息 以前保存用户配置信息时用到的是session和cookie。 session会话结束,保存的个人信息就会丢失,而cookie在一定程度上存在安全隐患
asp.net 2.0引入的profile技术 可以很好的解决该问题。
强类型 长期保存 支持匿名用户
定义配置(profile)
<?xml version="1.0"?>
<c ......
在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
使用无Cookie的表单认证票据
默认情况下,forms authentication system将决定是将票据存储在cookies
collection里还是插入用户访问页面的URL里。所有主流的桌面浏览器,比如Internet
Explorer,Firefox,Opera,或Safari都支持cookies,但并非所有的移动设备都支持。
forms authentication system使用何种co ......
<a>标签
1. <a href=”test.aspx”></a>
2. 这是最常见的一种转向方法;
HyperLink控件
1. Asp.net 服务器端控件 属性Naviga ......
<asp:TemplateField HeaderText="测试">
<ItemTemplate>
<asp:LinkButton ID="test" runat="server" OnClick="test_Click" OnClientClick='<%# string.Format("return confirmDelete(\"{0} {1}\");", DoEscape((string)Eval( ......