0

URLRewriting は初めてで、web.config で次のスクリプトを使用して .aspx 拡張子を削除しようとしています。

<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.

Web アプリケーションに書き換えエンジンを追加する必要がありますか?

このリンクをたどりましたが、取得できませんでした。

ステップバイステップのプロセスまたはサンプルスクリプトを教えてください。

4

4 に答える 4

1

次のルールを使用すると、毎回魔法のように機能します!

<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> 
于 2013-08-24T15:08:16.583 に答える
0

(自分で書く代わりに)

IIS 7 URL 書き換えモジュール:

http://www.microsoft.com/en-gb/download/details.aspx?id=7435

IIS 5/6 :

http://iirf.codeplex.com/

于 2013-05-17T13:55:38.940 に答える
0

ハウツー付きの素敵な書き換えエンジンを次に示します:)

http://www.codeproject.com/Articles/2538/URL-Rewriting-with-ASP-NET

http://www.codeguru.com/csharp/.net/net_framework/article.php/c19535/RewriteNET--A-URL-Rewriting-Engine-for-NET.htm

于 2013-05-17T13:21:00.313 に答える