統合マネージド パイプライン アプリ プールで完全に動作するカスタム URL 書き換え http モジュールを作成しました。
しかし、クラシックに切り替えると、動作しなくなります。
protected virtual void BaseModuleRewriter_AuthorizeRequest(
object sender, EventArgs e)
{
HttpApplication app = (HttpApplication) sender;
Rewrite(app.Request.Path, app);
}
protected void Rewrite(string requestedPath,HttpApplication app)
{
if (requestedPath.IndexOf('.') == -1)
{
Page page =PageManager.GetPageByAlias(requestedPath.EndsWith("/") ? requestedPath.Substring(0, requestedPath.Length - 1) : requestedPath);
if (page != null)
{
app.Context.RewritePath(page.RelativeUrl == null ? "/Default.aspx?PageId=" + page.Serial : page.RelativeUrl.Substring(1), false);
//app.Session["ThisPage"] = page;
app.Response.StatusCode = 200;
}
else
{
app.Response.StatusCode = 404;
}
}
}
「ページ」は、「RelativeUrl」と「AliasAddress」プロパティを持つデータベース エンティティであることを説明する必要があります。何が問題なのですか?