日期:2014-05-17  浏览次数:20412 次

Global.asax 中做了伪静态, 如何配置IIS服务器

void Application_BeginRequest(object sender, EventArgs e)
    {
        
        HttpContext context = ((HttpApplication)sender).Context;

        string requestPath = context.Request.Path.ToLower();
        string requestPath2 = requestPath.Replace("/", "");
        requestPath2 = requestPath2.Replace(".html", "");
        if ( bz_ui_utils.GetClassByURL(requestPath2) != string.Empty )
        {
            Context.RewritePath("~/infolist.aspx?curl=" + requestPath2);
        }
        switch (requestPath)
        {
            case "/index.html":
                Context.RewritePath("~/index.aspx");
                break;
            case "/price.html":
                Context.RewritePath("~/price.aspx");
                break;
            case "/next2.html":
                Context.RewritePath("~/next2.aspx");
                break;
            case "/next3.html":
                Context.RewritePath("~/next3.aspx");
                break;
        }

        string pattern = string.Format(@"/(.*)_show_info_id_([\d]+).html$");
        if (Regex.IsMatch(requestPath, pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled))
        {