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

asp.net生成静态页

先建个html模版页(template.htm):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>$title</title>
</head>
<body>
<table $htmlformat[0] height="100%" border="0" width="100%" cellpadding="10" cellspacing="0" bgcolor="#eeeeee" style="border:1px solid #000000">
<tr>
<td width="100%" valign="middle" align="left">
<span style="color: $htmlformat[1];font-size: $htmlformat[2]">$htmlformat[3]</span>
</td>
</tr>
</table>
</body>
</html>
在asp.net中的应用(c#):
   string[] format=new string[4];//定义和htmlyem标记数目一致的数组
   StringBuilder htmltext=new StringBuilder();
   try
   {
    using (StreamReader sr= new StreamReader(base.Server.MapPath(".")+"\\template.htm"))
     {
      String line;
      while ((line = sr.ReadLine()) != null)
      {
        htmltext.Append(line);
      }
      sr.Close();
     }
   }
   catch
   {
     Response.Write("<Script>alert('读取文件错误')</Script>");
   }
   //---------------------给标记数组赋值------------
   string title="模板测试";
   format[0]="background=\"bg.jpg\"";//背景图片
   format[1]= "#990099";//字体颜色
   format[2]="150px";//字体大小
   format[3]= "<marquee>生成的模板html页面</marquee>";//文字说明
   //----------替换htm里的标记为你想加的内容
   htmltext.Replace("$title",title);//把title不放在数组是为了比较一下,:)。这样写比较容易看懂
   for(int i


相关文档:

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

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

26种提高ASP.NET网站访问性能的优化方法

1. 数据库访问性能优化
数据库的连接和关闭
  访问数据库资源需要创建连接、打开连接和关闭连接几个操作。这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源。 ASP.NET中提供了连接池(Connection Pool)改善打开和关闭数据库对性能的影响。系统将用户的数据库连接放在连接池中,需要时取出,关闭时 ......

ASP.NET AJAX调用WebService

如何在客户端直接调用WebService中的方法?
这里结合经验自己写一写
1.首先新建一个 ASP.NET AJAX-Enabled Web Site,这样系统为我们自动配置好了环境,这主要体现在Web.config这个文件上,如果已有网站不是ASP.NET AJAX-Enabled Web Site也可以对照修改下Web.config,也可以达到相同的效果。
2.新建一个web服务,WebSer ......

ASP.NET恢复SqlServer数据库还原失败

在用Asp.net对备份的数据库文件进行还原的时候,有时候会出现下面的错误异常:
[因为数据库正在使用,所以未能获得对数据库的排它访问权。 RESTORE DATABASE 操作异常终止。已将数据库上下文改为 'master'。]
这个时候,自由等待其他进程释放对应权限后,才可还原成功!有没有解决办法呢?我参照【Java】对这个问题的解决 ......

ASP.NET Routing for URLRewriting with QueryStrings

In the last post I showed how to use the ASP.NET 3.5 Routing Engine
for URLRewriting purposes. I want to go further in this post by adding
the ability to add variables into a route path and forward and append
query string variables to the destination Web Form request.
A route can contain one or ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号