[ASP.NET]如何讀取web.config的資訊(appSettings,ConnectionString,WebConfigurationManager)

  • 7792
  • 0
  • 2016-06-08

摘要:[asp.net]如何讀取web.config的資訊

注意~這是FOR WEB專案用的喔
@讀取AppSettings

Dim pubSavingCode As String = ""
        pubSavingCode = System.Web.Configuration.WebConfigurationManager.AppSettings("PubSavingCode")

@讀取ConnectionString

 Dim strCn As String = ""
        strCn = System.Web.Configuration.WebConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString