Web/PagerHandler.ashx
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<%@ WebHandler Language="C#" Class="PagerHandler" %>
using System;
using System.Web;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Wld.DBCore;
public class PagerHandler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
string str = string.Empty;
//具体的页面数
int pageIndex;
int.TryParse(context.Request["pageIndex"], out pageIndex);
//页面显示条数
int size = Convert.ToInt32(context.Request["pageSize"]);
string type = context.Request["type"].ToString();
if (pageIndex == 0)
{
pageIndex = 1;
}
int record = size * pageIndex;
string sql = string.Empty;
if(pageIndex==1)
sql = "select top " + size + " * from [publish] Where [catagoryID]=" + type + " order by id desc";
else
sql = "select top " + size + " * from [publish] Where id not in(select top "+size*(pageIndex-1)+" id from [publish] where [catagoryID]=" + type + " order by id desc) and [catagoryID]=" + type + " order by id desc";
StringBuilder sb = new StringBuilder();
DBHelperSql helper = new DBHelperSql();
DataTable listT = helper.Select(sql);
for (int i = 0; i < listT.Rows.Count; i++)
{
sb.Append("<li><a href=\"Detail.aspx?id=" + listT.Rows[i]["id"] +"\" target=\"_blank\" >" + (listT.Rows[i]["articleTitle"].ToString().Length > 25 ? listT.Rows[i]["articleTitle"].ToString().Substring(0, 25) + "..." : listT.Rows[i]["articleTitle"].ToString()) + "</a>" + Convert.ToDateTime(listT.Rows[i]["addTime"]).ToString("yyyy-MM-dd") + "</li>");
}
str = sb.ToString();
context.Response.Write(str);
}
public bool IsReusable {
get {
return false;
}
}
public string StripHT(string strHtml) //从html中提取纯文本
{
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("<.+?>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
strHtml = strHtml.Replace("\r", "");
后面还有 13 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
