我想从ASP.Net的网页中删除.aspx。我下载URL Rewrite Module并安装到winserver 2008,这个: http://www.iis.net/downloads/microsoft/url-rewrite [^]
我是初学者,我试过
我也试过remove .aspx extention using IIS7 & URL Rewrite
但它不起作用。
例如更改default.aspx --->默认 我该怎么做呢?
我收到错误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
答案 0 :(得分: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&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".
答案 1 :(得分: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>
答案 2 :(得分: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.
-->