用谁知道asp.net里面的伪静态怎么做的,要详细的方法

解决方案 »

  1.   

    ...2楼是发链接地址 不是就那么几个字...
    伪静态现在网上例子很多 自己搜索一些
    流程就是 引用一个urlwrite.dll文件 然后web.config配置映射路径地址就可以了 
    很简单的 IIS发布时添加映射 就OK了
      

  2.   

    1.添加 URLRewriter.dll
    2.webconfig中配置 <configSections>
            <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
        </configSections> <httpModules>
                <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
            </httpModules>//映射
    </configSections>
        <RewriterConfig>
            <Rules>
                <RewriterRule>
                    <LookFor>~/url.aspx</LookFor>
                    <SendTo>~/default.aspx</SendTo>
                </RewriterRule>
                <RewriterRule>
                    <LookFor>~/url/</LookFor>
                    <SendTo>~/default.aspx</SendTo>
                </RewriterRule>
                <RewriterRule>
                    <LookFor>~/url.html</LookFor>
                    <SendTo>~/default.aspx</SendTo>
                </RewriterRule>
                <RewriterRule>
                    <LookFor>~/(.*)/(.*)/default.aspx</LookFor>
                    <SendTo>~/default.aspx?page=$1&amp;type=$2</SendTo>
                </RewriterRule>
            </Rules>
        </RewriterConfig>3.页面根据相应重写规则就可以访问对应页面了.
      

  3.   


    asp.net实现伪静态
    ASP.NET伪静态的实现及伪静态的意义
      

  4.   

    我要使用 HTTP 模块执行 URL 重写
      

  5.   

    我要使用 HTTP 模块执行 URL 重写,也就是我们说的伪静态,想要模拟的详细代码
      

  6.   

    用MVC吧,在Route中可以非常方便的添加规则,可以实现地址目录化,也可以很方便的改变文件后缀
      

  7.   

    Route吧,貌似WEBFORM也可以用的
      

  8.   

    没错。
    部署 一个Global.asax,再在web.config里配置一下这是我的例子:
    [C#]
         public class Global : System.Web.HttpApplication
        {
           //.....
           protected void Application_BeginRequest(object sender, EventArgs e)
            {
                string originalPath = Context.Request.Path.ToLower();
                if (Regex.IsMatch(originalPath, ".htm\\b") &&
                    (RewriteUrl(originalPath, "news")
                    || RewriteUrl(originalPath, "gallery")
                    || RewriteUrl(originalPath, "special")
                    || RewriteUrl(originalPath, "shop")
                    || RewriteUrl(originalPath, "albumcenter")
                    || RewriteUrl(originalPath, "newscenter")
                    || RewriteUrl(originalPath, "guestbook")
                    || RewriteUrl(originalPath, "shopdetails")
                    ))
                {
                }
            }        bool RewriteUrl(string originalPath, string name)
            {
                Regex reg = new Regex(name + "(_(?<id>\\d+))?(_p(?<page>\\d+))?.htm");
                var matchs = reg.Matches(originalPath);
                int id = 0;
                int page = 0;
                if (matchs.Count <= 0) return false;            page = CommOp.ToInt(matchs[0].Groups["page"].Value);
                id = CommOp.ToInt(matchs[0].Groups["id"].Value);
                string request = "";
                if (id > 0 && page > 0)
                {
                    request = "?Id=" + id + "&Page=" + page;
                }
                else if (id > 0)
                {
                    request = "?Id=" + id;
                }
                else if (page > 0)
                {
                    request += "?Page=" + page;
                }            string newPath = reg.Replace(originalPath, name + ".aspx" + request);            Context.RewritePath(newPath);
                return true;
            }
             ....
    [/C#]
    这是我在做www.aij1.com中的实际应用。