ユーザーが許可されていないときに Web サイトにリダイレクトする http モジュールがあります。次に、この Web サイトは資格情報を確認し、クエリ文字列に基づいてユーザーを元のページに戻します。
私が抱えている問題はRequest.Url.AbsoluteUri
、ルートディレクトリが要求されるたびに default.aspx を省略しているように見えることです。http://example/application/
この動作は、以下のテスト ケースを使用して確認できます。Response.Redirect
内で使用する場合Application_AuthenticateRequest
VS Web 開発サーバー Cassini は正常に動作し、正しくリダイレクトさhttp://example/application/?url=http://example/application/default.aspx
れます。(IIS6を実行しています)
namespace HI.Test {
public class Authentication : IHttpModule {
private HttpRequest Request { get { return HttpContext.Current.Request; } }
private HttpResponse Response { get { return HttpContext.Current.Response; } }
private Cache Cache { get { return HttpContext.Current.Cache; } }
public void Init(HttpApplication application) {
application.AuthenticateRequest += (new EventHandler(Application_AuthenticateRequest));
}
private void Application_AuthenticateRequest(Object source, EventArgs e) {
if (Request.QueryString["url"] == null) {
Cache.Insert("URLRedirected", Request.Url.AbsoluteUri);
Response.Redirect(Request.Url.AbsoluteUri + "?url=" + Request.Url.AbsoluteUri);
}
}
public void Dispose() {
}
}
}
私は明らかに問題の修正を探しています。また、なぜこれが起こるのかを理解したいと思っています。