代码改变世界

Appliction_BeginRequest

2012-04-27 12:22  cpine  阅读(196)  评论(0编辑  收藏  举报
void Application_BeginRequest(object sender, EventArgs e) {
            Regex reg = new Regex(@".+Thread-(\d+).html");
            var match = reg.Match(HttpContext.Current.Request.Url.AbsolutePath);
            if (match.Success) {
                string gradeId = match.Groups[1].Value;
                HttpContext.Current.RewritePath("ShowStudentInfo.aspx?gradeid=" + gradeId);
            }
        }