本帖最后由 Somnus133 于 2012-05-10 16:33:01 编辑

解决方案 »

  1.   

    可以伪静态,但是需要扩展名是.aspx或者其他需要.net处理的扩展名,不能使用iis本身处理的扩展名
      

  2.   

    win7 win2008
    可以在web.config中配
    2003 iis6 后缀名aspx
    想用html的 只能在iis6中配
      

  3.   

    现在是我不能够去配置服务器的IIS,空间是买的
    所以想通过编程来实现
      

  4.   

    那就不行了,静态文件iis直接返回的,根本不走.net程序的,采用aspx,。类似
    http://dotnet.aspx.cc/file/HttpWebRequest-Download-Redirected-File.aspx的结构。aspx对搜索引擎也是一样的
      

  5.   


    难道作伪静态一定要配置IIS 在其上面添加映射吗?真的没有别人方法了。。
      

  6.   

    伪静态有什么好?还不如aspx性能好
      

  7.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Text.RegularExpressions;/// <summary>
    ///UrlRewriteModule 的摘要说明
    /// </summary>
    public class UrlRewriteModule:IHttpModule
    {
    public UrlRewriteModule()
    {
    }    /// <summary>
        /// 初始化方法
        /// </summary>
        /// <param name="conext"></param>
        public void Init(HttpApplication context) {
            context.BeginRequest += new EventHandler(context_BeginRequest);
            context.EndRequest += new EventHandler(context_EndRequest);
        }    void context_EndRequest(object sender, EventArgs e)
        {
            HttpApplication context = sender as HttpApplication;
            if (context != null)
            {
                context.Response.Write("UrlRewriteModule");
            }
        }    void context_BeginRequest(object sender, EventArgs e)
        {
            HttpApplication context = sender as HttpApplication;
            if (context != null) {            Regex regex = new Regex(@"/UrlRewrite/Show/\d.html");            string path = context.Request.RawUrl.ToString();
                context.Response.Write(path);
                if (regex.IsMatch(path)) {                string[] ss = path.Split('/');
                    ss = ss[ss.Length - 1].Split('.');
                    int id = int.Parse(ss[0]);                context.Server.Transfer("/UrlRewrite/Show.aspx?id=" + id);
                }
            }
        }    /// <summary>
        /// 释放资源
        /// </summary>
        public void Dispose() { }
    }
    这样就行,不用弄IIS。web.config里加<httpModules>
        <add name="UrlRewriteModule" type="UrlRewriteModule"/>          
    </httpModules>
      

  8.   

    alex0917这里需要添加一个dll文件吧