易截截图软件、单文件、免安装、纯绿色、仅160KB

Asp.net生成静态页面原理

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
namespace menutest
{
///
/// Conn 的摘要说明。
///
// by kyo
// 此类是生成静态网页的小程序
public class Conn
{
public Conn()
   {
   }
public static bool WriteFile(string strText,string strContent,string strAuthor)
   {
string path = HttpContext.Current.Server.MapPath("/menutest/");
    Encoding code = Encoding.GetEncoding("gb2312");
// 读取模板文件
string temp = HttpContext.Current.Server.MapPath("/menutest/news/text.html");
    StreamReader sr=null;
    StreamWriter sw=null;
string str="";
try
    {
     sr = new StreamReader(temp,code);
     str = sr.ReadToEnd(); // 读取文件
    }
catch(Exception exp)
    {
     HttpContext.Current.Response.Write(exp.Message);
     HttpContext.Current.Response.End();
     sr.Close();
    }
//string htmlfilename=DateTime.Now.ToString("yyyyMMddHHmmss")+".html";
string htmlfilename="kyo.html";
// 替换内容
// 这时,模板文件已经读入到名称为str的变量中了
    str = str.Replace("ShowArticle",strText); //模板页中的ShowArticle
    str = str.Replace("biaoti",strText);
    str = str.Replace("content",strContent);
    str = str.Replace("author",strAuthor);
// 写文件
try
    {
  &#


相关文档:

ASP.NET的ACCESS数据库操作类

//private string datapatch = ConfigurationSettings.AppSettings["acessconn"];//数据库地址 
private string datapatch = "db/global.asa";//数据库地址 
/// 
/// 取得dataset 
// 
/// 查询语句 
/// 
public DataSet GetDataSet(string Commandtext) 
{&nbs ......

asp.net链接Access数据库字符串正确方法

在web  config中  作如下配置:
<connectionStrings>
    <add name="ydycon" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|ydy.mdb" providerName="System.Data.OleDb"/>
 
  </connectionStrings>
在.net文件中应用链接 ......

ASP.NET页面刷新方法总结

第一:
private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } 第二:
private void Button2_Click( object sender, System.EventArgs e ) { Response.Write( " < script language=javascript>window.location.href=document.URL; < /script&g ......

学习ASP.NET的缓存依赖机制

 高效使用使用SQL缓存依赖
 
ASP.NET Framework新增的一个非常强大的功能是SQL缓存依赖。该功能允许底层数据库中的数据修改时,自动地重新载入缓存的数据。
在使用绝对缓存过期策略或者弹性缓存过期策略时有一个权衡,对于性能和陈旧数据的权衡。例如,如果在内存中缓存数据20秒,则这20秒内显示的数据可能是� ......

在Web Service中使用ASP.net状态保持

原帖地址:http://www.wangchao.net.cn/bbsdetail_572426.html
      简介
  有许多聪明的办法可以解决HTTP协议的无状态问题,例如对每个请求重复发送应用程序数据包、使用HTTP认证机制来将请求映射到特定的用户、使用Cookie来存储一系列请求的状态等。在ASP.net技术中提供了 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号