Kobarin's Development Blog

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

2009-12-01から1ヶ月間の記事一覧

App_Codeでコントロールを定義する

App_Codeフォルダ配下に追加したコントロールを使用する方法。 ~/App_Code/webusercontrol.cs using System; using System.Text.RegularExpressions; namespace webusercontrol { /// /// /// public class LabelNumeric : System.Web.UI.WebControls.Label …

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"])…