技术: .NET 2.0 在 IHttpHandlerFactory 中得到的

翟二喜

IHttpHandler GetHandler( HttpContext context, string requestType, string url, string path )


下面是在实现 IHttpHandlerFactory 的类中 GetHandler 函数中得到的值(Web.Config 中已经在 HttpHandlers 设置中,将 path=* 映射到了这个HttpHandlerFactory 上:


访问地址:http://localhost/myweb/
path: d:\vhosts\myweb\
url: /myweb/
context.Request.Path: /myweb/


访问地址:http://localhost/myweb/a
path: d:\vhosts\myweb\a
url: /myweb/a
context.Request.Path: /myweb/a


访问地址:http://localhost/myweb/a/
path: d:\vhosts\myweb\a
url: /myweb/a/
context.Request.Path: /myweb/a/


访问地址:http://localhost/myweb/a/
path: d:\vhosts\myweb\a\
url: /myweb/a/
context.Request.Path: /myweb/a/


访问地址:http://localhost/myweb/a.aspx
path: d:\vhosts\myweb\a.aspx
url: /myweb/a.aspx
context.Request.Path: /myweb/a.aspx


访问地址:http://localhost/myweb/a.aspx?b=c
path: d:\vhosts\myweb\a.aspx
url: /myweb/a.aspx
context.Request.Path: /myweb/a.aspx


访问地址:http://localhost/myweb/a.aspx/b
path: d:\vhosts\myweb\a.aspx
url: /myweb/a.aspx
context.Request.Path: /myweb/a.aspx/b


访问地址:http://localhost/myweb/a.aspx/b.aspx/c.aspx
path: d:\vhosts\myweb\a.aspx
url: /myweb/a.aspx
context.Request.Path: /myweb/a.aspx/b.aspx/c.aspx

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: