利用UrlRewriter 实现二级域名
http://tech.ddvip.com 2008年06月12日 社区交流
本文详细介绍利用UrlRewriter 实现二级域名
改为
for(int i = 0; i < rules.Count; i++)
{
// get the pattern to look for, and Resolve the Url (convert ~ into the appropriate directory)
string lookFor = "^" + rules[i].LookFor + "$";
// Create a regex (note that IgnoreCase is set)
Regex re = new Regex(lookFor, RegexOptions.IgnoreCase);
// See if a match is found
if (re.IsMatch(requestedPath))
{
// match found - do any replacement needed
string sendToUrl = RewriterUtils.ResolveUrl(app.Context.Request.ApplicationPath, re.Replace(requestedPath, rules[i].SendTo));
// log rewriting information to the Trace object
app.Context.Trace.Write("ModuleRewriter", "Rewriting URL to " + sendToUrl);
// Rewrite the URL
RewriterUtils.RewriteUrl(app.Context, sendToUrl);
break; // exit the for loop
}
}
将
string lookFor = "^" + RewriterUtils.ResolveUrl(app.Context.Request.ApplicationPath, rules[i].LookFor) + "$";
改成了
string lookFor = "^" + rules[i].LookFor + "$";
作者:yaosansi 责编:豆豆技术应用
- asp.net 视频教程
- asp.net 数据库编程
- asp.net 入门教程
- ado.net 教程
- asp.net 基础讲座
- asp.net ajax 教程
- asp.net ajax 入门系列
- asp.net 控件开发基础
- asp.net 2.0 服务器控件
- asp.net 2.0 教程
- asp.net 控件开发
- asp.net 类
- asp.net 分页
- asp.net 页面缓存
- asp.net 常见问题解决
- asp.net 2.0 母版页
- asp.net SQL Server
- asp.net 错误
- asp.net 事件
- asp.net 组件
- asp.net 性能
- asp.net 文件上传
- 更多asp.net专题……