Kobarin's Development Blog

C#やASP.NETなどについての記録です。

2009-12-04から1日間の記事一覧

URLrewriteを使って、デフォルトページををスラッシュのみのページへリダイレクトさせる

http://example.jp/default.aspx や http://example.jp/index.htm を、 http://example.jp/ にRedirectする方法。以下はweb.configで「/index.aspx」を「/」にRedirectする例。 <system.webServer> <rewrite> <rule name="root_slash" stopProcessing="false"> <match url="^index\.aspx$"/> </match></rule></rewrite></system.webserver>

ASP.NETで、URLrewriteされたページでPostBackしてもURLを変えない方法

ページロード時にFormのActionを書き換えるらしい。 元の(Rewriteされた)URLを保存しているServerVariableを使う。 protected void Page_Load(object sender, EventArgs e) { if ( !String.IsNullOrEmpty(Request.ServerVariables["HTTP_X_ORIGINAL_URL"])…