代码改变世界

Appliction_BeginRequest

2012-04-27 12:22  cpine  阅读(208)  评论(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);
            }
        }