getAppSettingString
概要
web.config中の、「AppSetting」で定義した文字列を取得する。
引数
- 「AppSetting」の「key」
戻値
- 「AppSetting」の「value」
前提条件
手順
web.config にて以下を定義する。
<configuration>
<appSettings>
<add key="ConnectString" value="接続文字列"/>
</appSettings>
</configuration>
default.aspx.vb で以下のように使用する。
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
not found (235.jpg)