在asp.net的iis中使用URL重写从页面中删除.aspx
本文关键字:重写 aspx 删除 URL net asp iis | 更新日期: 2023-09-27 18:03:22
我想从我的网页在ASP.Net中删除。aspx。我下载URL重写模块并安装到winserver 2008和这个:http://www.iis.net/downloads/microsoft/url-rewrite [^]
我是初学者,我试过了
我还尝试使用IIS7 &URL重写
但是它不工作。
例如更改默认值。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
U can do this in your web.config file itself
<system.web>
<urlMappings enabled="true">
<add url="~/marutisuzuki-Alto" mappedUrl="~/Carmodel.aspx?carname=Alto&carid=6"/>
</urlMappings>
</system.web>
If you add this if any page with this "~/Carmodel.aspx?carname=Alto&carid=6" is replaced by "~/marutisuzuki-Alto".
使用URL重写模块尝试在您的web。配置(系统内部)。网络服务器元素):
<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>
my web config:
<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.
-->