Microsoft ASP.NET Programming with Microsoft Visual Basic .NET Version 2003 Step by Step [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Microsoft ASP.NET Programming with Microsoft Visual Basic .NET Version 2003 Step by Step [Electronic resources] - نسخه متنی

G. Andrew Duthie

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Setting and Retrieving Custom Application Settings

The final configuration element is a special one because it allows you to configure your own custom application settings, which can then be easily retrieved from within your ASP.NET applications.


<appSettings>


The <appSettings> element allows you to create your own configuration settings as key/value pairs. You can use this configuration element to store configuration information such as DSNs for data access, and then retrieve them in your application using the following syntax:

DimDSNAsString
DSN=ConfigurationSettings.AppSettings("dsn")

This is assuming that you’ve stored the DSN using “dsn” as the key.

The <appSettings> element has the following syntax:

<appSettings>
<add
key="string"
value="string"/>
<clear/>
<remove
key="string"/>
</appSettings>

Table B-20 describes the <appSettings> element attributes in more detail.






























Table B-20: <appSettings> Element Attributes

Element


Attribute


Description


<appSettings>


Creates key/value pairs that can be retrieved using ConfigurationSettings.AppSettings(key).


<add>


Adds a key/value pair.


key


Specifies the name of the key to use to retrieve the value.


value


Specifies the value to be returned.


<clear>


Removes all key/value pairs added (or inherited) by the current Web.config file.


<remove>


key


Removes the specified name/value pair added (or inherited) by the current Web.config file.


/ 126