【C#中实现伪静态页面两种方式介绍】教程文章相关的互联网学习教程文章

C#中实现伪静态页面两种方式介绍

第一种是在页面global.asax中,相关代码如下: 代码如下:void Application_BeginRequest(object sender, EventArgs e) { HttpContext context = ((HttpApplication)sender).Context; string oldurl = context.Request.Path.ToLower(); if ( ( oldurl.IndexOf("-") > 0 && oldurl.IndexOf(".") == -1) || (oldurl.IndexOf("-") > 0 && oldurl.IndexOf("aspx") > 0) ) { string[] url = oldurl.Substring(oldurl.LastIndexOf("/") +...