易截截图软件、单文件、免安装、纯绿色、仅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 控件开发之资源文件处理

在WEB开发中经常会使用一些JS,IMAGE,CSS等相关数据。在WEB解决方案中经常做为一个文件夹处理。在使用的页面中引用相对路径就可以了。但在控件开发中,就碰到一个问题。如果我的控件需要一个JS文件或是CSS文件或是一个图片怎么办?总不能在控件的DLL文件外再加一个放置需要文件的文件夹。每次用都需要拷贝过去。太麻烦了, ......

ASP.NET中防止页面多次提交的代码实现

此处提供的代码用来实现当asp.net页面中的某个Button被点击后disable掉该页面中所有的Button,从而防止提交延时导致的多次提交。基于之前的onceclickbutton脚本.
//ASP.NET中防止页面多次提交的代码:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElem ......

ASP.NET 3.5 MVC 架构与实战笔记6 HtmlHelper控件解析

FormExtensions类
FormExtensions类是一个静态类,定义了3种类型的扩展方法:BeginForm、BeginRouteForm、EndForm;在实际开发中,也可以使用using语句,而不需要写EndForm扩展方法。
InputExtensions类
InputExtensions类定义了5种类型的扩展方法:CheckBox,Hidden,Password,RadioButton,TextBox.

<field ......

Asp.net中cache对象简介

Asp.net支持三种类型的cache
想写一个技术快速概述,可能写得太多了。技术概略的目的是以最快最简单的方式描述出技术要点,也是我希望的最有效率的知识传播方式。
1. 页面/控件cache
2. 应用程序级cache
3. 浏览器客户端cache
从实现方式来看,页面/控件cache和应用程序级cache都是存放在服务器内存里面的,随着内 ......

asp.net操作数据库相关[导入]

使用DataRelation类创建关系并利用父/子关系读取数据示例
 void Page_Load(object sender, System.EventArgs e)
{
// 连接字符串和 SQL 语句
string ConnString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionSqlServer"];
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号