还是不行,
假如我输入http://abc.cn/news/ 匹配结果是:http://abc.cn/default.aspx?param=news
或者http://abc.cn/ 匹配结果是http://default.aspx?param=abc.cn
解决方案 »
- 请帮忙改下jsp使得支持Firefox及opera
- html编辑器在FF下取值的问题
- 在调用方法时把另一个方法的方法名放到参数里有什么用?
- http://www.sooch.cn/product/product.jhtml;jsessionid=61D4F6429C23D3D3DDAB4262B7AB7EFC?category003=01是怎么实现的
- javascript中调用ActiveX控件的问题,急!!
- select 样式为平的---急急急急急
- *********很简单的问题,请高手帮忙 ***********
- 不好意思,专家分才过1000散点分玩咯:)
- 求助高手帮忙,下拉到底部会让尾部的div显示,然后继续下拉尾部又消失了,怎么才能下拉到尾部时,尾部内容能出现,然后滚动条到下面,然后上拉内容消失?
- 大哥们,这个是啥意思,引入还是
- 菜鸟求救,HTML插入JS问题,按钮怎么没有响应
- js checkbox 勾选
我这样去写,
当我http://abc.cn/aboutUs/notice/的时候访问的http://abc.cn/aboutUs/default.aspx,应该访问的是notice文件夹下的default.aspx文件才对,其他访问都正常
pattern = string.Format(@"/(.[0-9a-zA-Z]*)/$");
if (Regex.IsMatch(requestPath, pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled))
{
string file = requestPath.Substring(0, requestPath.Length - 1) + ".aspx"; ;
file = Server.MapPath("~" + file);
if (System.IO.File.Exists(file))
file = "/$1.aspx";
else
file = "/default.aspx?param=$1";
// 这里的问题, /default.aspx?param=$1 代表的是根目录,需要把路径加到这里,用这则提取一下路径加进来就行 了
string newUrl = Regex.Replace(requestPath, pattern, file, RegexOptions.IgnoreCase | RegexOptions.Compiled);
Context.RewritePath(newUrl);
}