私はIIS7には、何かの作業を持っていると思う...しかし、一種の脆いようだ:このようなセットアップ、私はHttpModuleをしてい
:
<modules runAllManagedModulesForAllRequests="true">
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="MyRewriteModule" preCondition="managedHandler" type="MyWeb.MyRewriteModule, MyWeb" />
</modules>
と、次のように私のモジュールは、コードを持っています:
void context_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
HttpRequest request = app.Context.Request;
List<string> ignoreExtensions = new List<string>() { "axd", "gif", "ico" };
if(ignoreExtensions.TrueForAll(s => !request.FilePath.ToLower().EndsWith(s)))
app.Context.RewritePath("~/default.aspx", request.Path, request.QueryString.ToString(), true);
}
明らかに私はそのリストをキャッシュして拡張しますが、全体的にはうまくいくようです。誰も明白な欠点を指摘できますか?
これは機能していますが、物理的に存在しないファイルの要求を受け取るモジュールは、どのように取得すればよいですか? – Jonas
IISでこの設定がありますが、ASP.Net ISAPI dllですべての要求を処理する必要があるため、速度が低下すると考えられます。私はこれを一瞬のうちに歩みながら自分の投稿を編集します。 –