a.aspx<form runat="server">
<input id="keyword" runat="server" />
<asp:Button ID="bt2" runat="server" Text="search" OnClick="bt2_Click" />
</form>a.aspx.cs//省略
protected void bt2_Click ()
{
 string m = Request.Params["keyword"];
 Response.Redirect("search.aspx?w=" + m + " ");
}如果输入一个关键字,比如 net
这个时候,URL链接是 http://domain.com/search.aspx?w=net
但我想实现的是 http://domain.com/s?w=net
这样的形式,请问这个该怎么做呢?

解决方案 »

  1.   

    伪装后缀,http://blog.csdn.net/simonezhlx/archive/2009/12/08/4962046.aspx,自己看吧
      

  2.   

    这似乎不对吧,本来是 http://domain.com/search.aspx?w=net 可以知道扩展名是.aspx
    但是是 http://domain.com/s?w=net  这个扩展名是什么呢?
      

  3.   

    我在IIS中的操作是IIS配置:网站->属性->目录->配置(G)...->映射->通配符应用程序映射->插入可执行文件:c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll确认文件是否存在:不选确定后,重启IIS,在WEB.CONFIG中写入<?xml version="1.0"?>
    <configuration>
    <configSections>
            <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
    </configSections>
    <appSettings>
    </appSettings>
    <RewriterConfig>
            <Rules>
                <RewriterRule>
                    <LookFor>~/s?w=$1</LookFor>
                    <SendTo>~/search.aspx?w=$1</SendTo>
                </RewriterRule>
            </Rules>
        </RewriterConfig>
    <system.web>
    <customErrors   mode="Off"/>
    </system.web>
    </configuration>URLRewriter.dll放入了BIN文件夹
    但还是没有作用,请问错在哪里呢?但还是不成功,出错
      

  4.   

    建一个httpmodule,然后拦截这个URL,自己用contextrewrite,写到真是的地址上去就可以了。