0
有好日子ALL YOU THE。
我已经创建了Asp.net C#网站,SqlServer的2005年
我的要求是我不想显示扩展名的.aspx在 浏览器。
例如我有Products.aspx页面.... fom这些我想在浏览器中显示 产品。
请帮帮我。
有好日子ALL YOU THE。
我已经创建了Asp.net C#网站,SqlServer的2005年
我的要求是我不想显示扩展名的.aspx在 浏览器。
例如我有Products.aspx页面.... fom这些我想在浏览器中显示 产品。
请帮帮我。
更改webconfig
文件是这样的:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Product.aspx Redirect" stopProcessing="true">
<match url="^(.*\/)*Product\.aspx$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_METHOD}" negate="true" pattern="^POST$" />
</conditions>
<action type="Redirect" url="{R:1}" redirectType="Permanent"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
尝试这些它会帮助你..
<configuration>
<system.webserver>
<rewrite>
<rules>
<rule name="extensionless" stopprocessing="true">
<match url="(.*)\.html$" />
<action type="Redirect" url="{R:1}" redirecttype="Permanent" />
</rule>
<rule name="removeextension" enabled="true">
<match url=".*" negate="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchtype="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchtype="IsDirectory" negate="true" />
<add input="{URL}" pattern="(.*)\.(.*)" negate="true" />
</conditions>
<action type="Rewrite" url="{R:0}.html" />
</rule>
</rules>
</rewrite>
</system.webserver>
</configuration>
切换到asp.net的MVC。没有比这更好的解决方案。 –
安装IIS重写模块并执行此操作:https://stackoverflow.com/questions/6097592/removing-aspx-from-pages-using-rewritemodule – VDWWD
实际上,您有两种选择:ASP.NET路由和URL重写。你可以在这里找到一个比较:https://stackoverflow.com/questions/90112/iis-url-rewriting-vs-url-routing –