0

我想从我的 ASP.Net 网页中删除 .aspx。我下载 URL 重写模块并安装到 winserver 2008 和这个: http ://www.iis.net/downloads/microsoft/url-rewrite [^]

我是初学者,我试过了

我还尝试使用 IIS7 和 URL 重写删除 .aspx 扩展

但它不起作用。

例如更改 default.aspx ---> default 我该怎么做?


我收到错误 404 - 找不到文件或目录。当我使用此代码时:

<rewrite>
<rules>
    <rule name="Rewrite aspx" stopProcessing="true">
      <match url="^([a-z0-9/]+).aspx$" ignoreCase="true"/>
      <action type="Redirect" url="{R:1}"/>
    </rule>
</rules>

请 F1F1F1F1F1

4

3 回答 3

0
U can do this in your web.config file itself

 <system.web>

    <urlMappings enabled="true">

        <add url="~/marutisuzuki-Alto" mappedUrl="~/Carmodel.aspx?carname=Alto&amp;carid=6"/>
</urlMappings>
</system.web>

If you add this if any page with this "~/Carmodel.aspx?carname=Alto&amp;carid=6" is replaced by "~/marutisuzuki-Alto".
于 2013-03-12T07:13:42.587 回答
0

使用 URL 重写模块在您的 web.config 中尝试此操作(在 system.webServer 元素内):

<rewrite>
    <rules>
        <rule name="Rewrite aspx" stopProcessing="true">
          <match url="^([a-z0-9/]+).aspx$" ignoreCase="true"/>
          <action type="Redirect" url="{R:1}"/>
        </rule>
    </rules>
</rewrite>
于 2013-03-12T07:17:42.033 回答
0

我的网络配置:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
        <remove name="ChartImageHandler" />
        <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </handlers>
    <security>
        <authentication>
            <basicAuthentication enabled="false" />
            <windowsAuthentication enabled="false" />
        </authentication>
    </security>
    <rewrite>
        <rule name="Rewrite aspx" stopProcessing="true">
            <match url="^([a-z0-9/]+).aspx$" ignoreCase="true"/>
            <action type="Redirect" url="{R:1}"/>
        </rule>



    </rewrite>
    <urlCompression doStaticCompression="true" doDynamicCompression="true" />
        </system.webServer>
<appSettings>

    <add key="ChartImageHandler" value="storage=file;timeout=20;" />
</appSettings>
<system.web>


    <httpHandlers>
        <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
    </httpHandlers>
    <customErrors mode="On" defaultRedirect="ErrorPage" />
    <!-- 
        Set compilation debug="true" to insert debugging 
        symbols into the compiled page. Because this 
        affects performance, set this value to true only 
        during development.
    -->
    <compilation debug="true" targetFramework="4.0">
        <assemblies>
            <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </assemblies>
    </compilation>

    <authentication mode="Windows" />

    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
        <controls>
            <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        </controls>
    </pages>
    <httpRuntime maxRequestLength="10480" />
    <identity impersonate="false" />

</system.web>

<!-- 
    The system.webServer section is required for running ASP.NET AJAX under Internet
    Information Services 7.0.  It is not necessary for previous version of IIS.
-->

于 2013-03-12T07:50:12.100 回答