English 中文(简体)
从 Web 应用程序中删除 aspx 扩展名
原标题:Removing the .aspx extension from the web application

我新加入 URL 重新撰写, 并试图使用以下脚本删除.aspx 扩展名 。 config

<configuration>
  <configSections>
     <section name="rewriteModule" type="RewriteModule.RewriteModuleSectionHandler, RewriteModule"/>
  </configSections>
 <connectionStrings>

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

然而,我在这方面没有成功。此外,下面的代码块给了我一个错误。

 <httpHandlers>
       <add verb="*" path="*.aspx" 
            type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
 </httpHandlers>

> Could not load file or assembly  URLRewriter  or one of its
> dependencies. The system cannot find the file specified.

需要我在我的网络应用程序中添加重写引擎吗?

我翻阅了""http://msdn.microsoft.com/en-us/library/ms972974#urlrefrey_topic3""rel="nofollow" >这个链接 ,但我搞不懂。

有没有人能建议我一步一步的 过程或样本脚本?

问题回答

使用以下的规则, 工作像一个魅力 每一次!

<rule name="san aspx">
  <!--Removes the .aspx extension for all pages.-->
  <match url="(.*)" />
  <conditions logicalGrouping="MatchAll">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  </conditions>
  <action type="Rewrite" url="{R:1}.aspx" />
</rule> 

似乎您没有在 Web 工程中为类 URLRefrictor 添加 dll 引用 。 添加此引用来解决这个问题 。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签