以前我分页就是通过参数传递来获取页数。一般在url是这样的
http://forum.csdn.net?pageId=1
pageId就是页数而现在一般的大型网站他们的路径就不是这个样子的了
比如:第一页 地址栏上的路径就是
http://forum.csdn.net/1.html
第二页
http://forum.csdn.net/2.html如此类推请问这个是怎么实现的呢?
http://forum.csdn.net?pageId=1
pageId就是页数而现在一般的大型网站他们的路径就不是这个样子的了
比如:第一页 地址栏上的路径就是
http://forum.csdn.net/1.html
第二页
http://forum.csdn.net/2.html如此类推请问这个是怎么实现的呢?
如果是伪静态的话,可以取出URL不的1及2,照样可以以你那种方式实现
加入
<httpHandlers>
<add verb="*" path="*.html" type="WebApplication5.Handler1 ,WebApplication5"/>
</httpHandlers>
在下面的handler1.ashx中using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using MyData_object;
using System.Configuration;
using System.Web.Configuration;namespace WebApplication5
{
/// <summary>
/// $codebehindclassname$ 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Handler1 : IHttpHandler
{ public void ProcessRequest(HttpContext context)
{
string s = context.Request.RawUrl.Substring(0, context.Request.RawUrl.LastIndexOf("/"));
string s1 = context.Request.RawUrl.Substring(context.Request.RawUrl.LastIndexOf("/"));
string q= s1.Substring(0, s1.IndexOf("."));
context.Server.Transfer(s + "?pageid=" + q.ToString());
} public bool IsReusable
{
get
{
return false;
}
}
}
}
IIS中把Html关联的aspx所用的处理程序http://www.mybuffet.cn