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

asp.net对于长篇文章进行分页

对于文章篇幅比较长的,就必须采用分页显示。在.net中对长篇文章分页一般有2种方法,第一种就是先计算好一页的文字长度是多少,然后把文章总的长度除设置好的单页文字长度及可,用这方法可以减少认为进行分页的繁琐,但是这样分页出来的可能不是很正确,因为不能达到想在某些特点位置进行分页。第二种就是通过人为和程序实现的。由人在新闻添加的时候在需要分页的地方输入指定的分页符号(主要是在文章中不常见的符号比如$$等),然后程序在通过指定的分页符号进行分页,这样就可以做到想在哪分页就在哪分页了。而本文也是使用的第二种方法,以下是c#代码片段:
public string NoHTML(string Htmlstring) //去除HTML标记
{
//删除脚本
Htmlstring = Regex.Replace(Htmlstring, @" <script[^>]*?>.*? </script>", "", RegexOptions.IgnoreCase);
//删除HTML
Htmlstring = Regex.Replace(Htmlstring, @" <(.[^>]*)>", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @" <!--.*", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", " <", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);",


相关文档:

ASP.NET 服务器控件渲染到客户端之后对应的HTML标签

服务器控件        html标记
label----------<span/>
button---------<input type="submit"/>
textbox--------<input type="text"/>
linkbutton-----<a href="javascript:" />
imagebutton----<input type="image"/>
hyperlink------<a />
......

asp.net 程序自动提交登陆表单并保持Session及Cookie

1、通过附加一个cookiecontainer到httprequest对象中,可以得到登录后返回的代表SESSION ID的COOKIE。
2、将此COOKIE包含在一个cookiecontainer中并附加到另一个HTTPREQUEST请求中,则可以实现SESSION的还原。
部分主要代码:
        CookieContainer cookieContainer =& ......

asp.net调用带返回值参数的存储过程

public static bool AddTbmember(Tbmember member, string regip)
{
bool check = false;
try
{
SqlCommand sqlcommnad = new SqlCommand("Pro_AddUsers", sqlconn.GetConn());
sqlcommnad.CommandType = CommandType.StoredProcedure; ......

asp.net生成静态页面

Default..aspx
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
Default..aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.We ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号