「getAppSettingString」の編集履歴(バックアップ)一覧に戻る
getAppSettingString - (2008/02/18 (月) 10:34:23) のソース
// 現在のページ名 *&this_page() **概要 web.config中の、「AppSetting」で定義した文字列を取得する。 ***引数 -「AppSetting」の「key」 ***戻値 -「AppSetting」の「value」 **前提条件 なし **手順 web.config にて以下を定義する。 #highlight(xml){ <configuration> <appSettings> <add key="ConnectString" value="接続文字列"/> </appSettings> </configuration> } default.aspx.vb で以下のように使用する。 #highlight(vb.net){ Partial Class _Default Inherits class_common Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim str_temp As String = getAppSettingString("ConnectString") Response.Write(str_temp) End Sub End Class } &img(235.jpg)