我爱Aspx >> Asp.Net >> 用好ASP.NET 2.0的URL映射http://aspalliance.com/1 (article ID 1, which is my Excel Reports in ASP article).
The nice thing about this is that it uses Context.RewritePath, so there is no Response.Redirect and the user never sees the actual URL of the page handling the request. The regex I'm using is here:
http://regexlib.com/REDetails.aspx?regexp_id=456
The actual code looks like this:
string originalUrl = Request.Url.ToString();
// Check for article shortcuts (e.g. http://aspalliance.com/1 )
string newUrl = AspAlliance.Web.Core.HttpRedirect.GetRedirect(originalUrl);
if(newUrl != originalUrl)
{
System.Uri myUri = new System.Uri(newUrl);
Context.RewritePath(myUri.PathAndQuery);
}
// GetRedirect:
System.Text.RegularExpressions.Regex regex =
new System.Text.RegularExpressions.Regex(@"\.com/(\d+)$",
(System.Text.RegularExpressions.RegexOptions.Compiled |
Ҷƪл˵?
ASP.NET 2.0 中收集的小功能点[05-20]
在asp.net2.0中用WebPart代替Pla..[05-20]
利用XSL和ASP实现XML文档在线编辑[05-20]
ASP.NET 2.0,无刷新页面新境界![05-20]
利用JSP的思想来做ASP[05-20]
ASP实用技巧 强制刷新网页[05-20]
ASP实现多语言支持[05-20]
把.NET程序部署到没有安装.NET F..[05-20]
.NET框架中的驱动程序应用技术[05-20]
如何得到硬盘序列号.net [C#][05-20]
ASP.NET 2.0 中收集的小功能点[05-20]
Visual C# 3.0 新特性概览 (二)[05-20]
Visual C# 3.0 新特性概览(一)[05-20]
利用HttpRequest登录到某个网站,..[05-20]
C#中调用Windows API的要点[05-20]
MODEM AT指令集[05-20]
玩转Modem~AT指令篇- -[05-20]
[翻译]JavaScript和Macromedia F..[05-20]
c#收取邮件[05-20]
在asp.net2.0中用WebPart代替Pla..[05-20]