473,654 Members | 3,040 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what's this <%$ AppSettings:som ething %> means

I just can't understand what appSettings
means, how it work
thanks for your read
osamede
May 17 '07 #1
5 1433

"Osamede Zhang" <os*****@163.co mwrote in message
news:e8******** ******@TK2MSFTN GP02.phx.gbl...
>I just can't understand what appSettings
means, how it work
It refers to a setting in the AppSettings section in the web.config file.
something refers to the name of the setting.
The entire expression is replaced by the value of the setting when the page
is run.

Riki
May 17 '07 #2
As Riki explained, but to add - its also bad practice as app settings is a
collection which used like this has to be iterated in its entirety to get
that specific value from the file every time. For performance it would be
better if this was read at application start once and stored in the
application object for use each time.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

"Riki" <la**@mij.gerus twrote in message
news:us******** ******@TK2MSFTN GP02.phx.gbl...
>
"Osamede Zhang" <os*****@163.co mwrote in message
news:e8******** ******@TK2MSFTN GP02.phx.gbl...
>>I just can't understand what appSettings
means, how it work

It refers to a setting in the AppSettings section in the web.config file.
something refers to the name of the setting.
The entire expression is replaced by the value of the setting when the
page is run.

Riki

May 17 '07 #3
re:
!>I just can't understand what appSettings

It means just what its name implies.

It's a designated repository for application configuration information which is used
in the app, like database connection strings, file paths, XML Web service URLs, etc.

Here's examples of multiple ways to use appSettings :

http://www.codeproject.com/dotnet/namevaluemultiple.asp

http://www.odetocode.com/Articles/345.aspx

http://www.codeproject.com/dotnet/En...ppSettings.asp

http://msdn2.microsoft.com/en-us/lib...13(VS.71).aspx


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Osamede Zhang" <os*****@163.co mwrote in message news:e8******** ******@TK2MSFTN GP02.phx.gbl...
>I just can't understand what appSettings
means, how it work
thanks for your read
osamede

May 17 '07 #4
Thanks for your reply,it's very useful,
But how <%$ AppSettings:som ething %is working? which class is really used
to read the file?

"John Timney (MVP)" <x_****@timney. eclipse.co.uk>
As Riki explained, but to add - its also bad practice as app settings is a
collection which used like this has to be iterated in its entirety to get
that specific value from the file every time. For performance it would be
better if this was read at application start once and stored in the
application object for use each time.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

"Riki" <la**@mij.gerus twrote in message
news:us******** ******@TK2MSFTN GP02.phx.gbl...
>>
"Osamede Zhang" <os*****@163.co mwrote in message
news:e8******* *******@TK2MSFT NGP02.phx.gbl.. .
>>>I just can't understand what appSettings
means, how it work

It refers to a setting in the AppSettings section in the web.config file.
something refers to the name of the setting.
The entire expression is replaced by the value of the setting when the
page is run.

Riki


May 17 '07 #5
re:
!But how <%$ AppSettings:som ething %is working?
!which class is really used to read the file?

You don't need a specific class.
The $ syntax is built into the Configuration Manager workspace.

$, in this context, means *evaluate* the applicable section of web.config.

If you have :
<appSettings>
<add key="selectDocs " value="SELECT * FROM documents WHERE thereisdata ORDERBY CreationDate DESC"/>
</appSettings>

You can retrieve the value of that query with :

<asp:Literal runat="server" Text="<%$ AppSettings:sel ectDocs%>" /><br/>

If you have:
<connectionStri ngs>
<add name="NwindConn "
connectionStrin g="server=(loca l);trusted_conn ection=true;dat abase=northwind "
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>

You can retrieve the value of that query with :

<asp:Literal runat="server" Text="<%$ ConnectionStrin gs:NwindConn%>" />

Of course, you could also transfer those values to text variables and use them in other forms.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Osamede Zhang" <os*****@163.co mwrote in message news:uC******** ******@TK2MSFTN GP06.phx.gbl...
Thanks for your reply,it's very useful,
But how <%$ AppSettings:som ething %is working? which class is really used to read the file?

"John Timney (MVP)" <x_****@timney. eclipse.co.uk>
>As Riki explained, but to add - its also bad practice as app settings is a collection which used
like this has to be iterated in its entirety to get that specific value from the file every time.
For performance it would be better if this was read at application start once and stored in the
application object for use each time.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

"Riki" <la**@mij.gerus twrote in message news:us******** ******@TK2MSFTN GP02.phx.gbl...
>>>
"Osamede Zhang" <os*****@163.co mwrote in message news:e8******** ******@TK2MSFTN GP02.phx.gbl...
I just can't understand what appSettings
means, how it work

It refers to a setting in the AppSettings section in the web.config file.
something refers to the name of the setting.
The entire expression is replaced by the value of the setting when the page is run.

Riki



May 17 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
3330
by: seberino | last post by:
Tuples are defined with regards to parentheses ()'s as everyone knows. This causes confusion for 1 item tuples since (5) can be interpreted as a tuple OR as the number 5 in a mathematical expression such as x = (5) * (4+6). Wouldn't it have been better to define tuples with <>'s or {}'s or something else to avoid this confusion?? Perhaps ()'s are a good idea for some other reason I don't know?
2
10555
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
2
15927
by: ESPNSTI | last post by:
Hi, I'm trying to use a generics dictionary with a key class that implements and needs IComparable<>. However when I attempt to use the dictionary, it doesn't appear to use the IComparable<> to find the key. In the example below, accessing the dictionary by using the exact key object that was used to add to the dictionary works. (see code comment 1). However, if I attempt to access the dictionary by using a key object that
2
1663
by: Kenneth | last post by:
Hi, In web.config I have an appsettings: <appSettings> <add key="constring" value="Server=localhost;UID=sa;PWD=secret;Database=myDB" /> </appSettings> This is for my developing machine.
5
1883
by: ad | last post by:
I find there are some tag like <%= %> and <%# > in my .aspx file. What is the diffreence between <%= %> and <%# %>
9
1230
by: A.M | last post by:
Hi, I am analysing a VB.NET code and i see this line of code: Dim strCacheKey As String = & "provider" What is the role of ?
4
3221
by: giannis | last post by:
I am a newbie at VB. When i try to remove an item from the BindingSource and try to delete this item from the database: BindingSource.RemoveCurrent() Me.TABLETableAdapter.Update(Me.DataSet.TABLE) i receive the message :
7
57535
by: Andrew Robinson | last post by:
I have a method that needs to return either a Dictionary<k,vor a List<v> depending on input parameters and options to the method. 1. Is there any way to convert from a dictionary to a list without itterating through the entire collection and building up a list? 2. is there a common base class, collection or interface that can contain either/both of these collection types and then how do you convert or cast from the base to either a...
3
3366
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt, &gt ,&ltCompany&gt to display '<', '>' and '<Company>' respectively. But is there any freeware code available which could implement the above functionality without having to use &gt,&lt and such stuff???
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8707
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8482
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7306
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1593
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.