Buy Questpond's video subscriptions on
huge discount
.
Online: 7832
Home
Articles
Interviews
Forums
For Beginners
Popular Questions
ITIL Career Advice
PMP Career Advice
Career Advices
Codes
Videos
ASP.NET
ASP.NET MVC
Android Intel XDK
Sql Server
AngularJS
Bootstrap
Backbone.JS
MongoDB
LESS (CSS)
jQuery
WPF
WWF
SSIS
LightSwitch
Tutorials
News
ASP.NET MVC
|
Be Interview Ready
|
Top Performers
|
DNF MVP
|
Top Posts
|
Winners
|
Subscribe
|
Catalogs
Welcome Guest !
Register
Login
Home
>
Forums
>
ASP.NET
>
Loading ...
Retrieve multiple values in web.config file
Posted by
Venkatesh
under
ASP.NET
on 3/3/2011 |
Points: 10
| Views : 6509 | Status :
[Member]
| Replies : 7
Write New Post
|
Search Forums
|
Resolved Posts
|
Un Answered Posts
|
Forums Home
Hi,
in Web.config file i mentioned same key in appsettings.And how to retrieve these values
ex:<add key="First" value="dotnet"/>
<add key="First" value="dotnetfunda"/>
how to retrieve these two values
Thanks & Regards
Venkatesh
Reply
|
Reply with Attachment
Alert Moderator
Responses
Posted by:
Raja
on: 3/3/2011
[Member]
Starter
|
Points: 25
0
Strange, why to keep two appsettings with same key and same value?
What is the benefit of it and what you are achieving it?
Regards,
Raja, USA
Venkatesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Venkatesh
on: 3/3/2011
[Member]
Starter
|
Points: 25
0
Hi
This is asked in interview.
Thanks & Regards
Venkatesh
Venkatesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Madhu.b.rokkam
on: 3/3/2011
[Member]
[MVP]
Bronze
|
Points: 25
0
Hi,
Even though you specify multiple appsettings keys with same name in a web.config file the last one will be considered and rest all will be ignored. So in your case if you search by your key name First you will get the value as dotnetfunda as result.
Thanks and Regards
Madhu
Venkatesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Karthikanbarasan
on: 3/3/2011
[Member]
[Moderator]
[Microsoft_MVP]
[MVP]
Silver
|
Points: 25
0
Hi venkatesh,
I have a question here, if the interview question is like this. Does the same key value pair is available in Parent Web.config and also in Child web.config with different values? Or in the same Web.Config with same key and different value?
If its in the same Web.Config i hope it should not work. If its in Parent and Child then it will fetch the value from Child config
Thanks
Karthik
www.f5Debug.net
Venkatesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Madhu.b.rokkam
on: 3/4/2011
[Member]
[MVP]
Bronze
|
Points: 25
0
Hi karthik,
If its in the same Web.Config then it does work but the last one i mean the bottom one will be considered and rest all will be ignored.
if we give this
<add key="First" value="dotnet"/> // Ignored
<add key="First" value="dotnetfunda"/> //Considered
Thanks and Regards
Madhu
Venkatesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Venkatesh
on: 3/4/2011
[Member]
Starter
|
Points: 25
0
Hi madhu
Its correct but its fetching second value So, how to retreive first value
Thanks & Regards
Venkatesh
Venkatesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Karthikanbarasan
on: 3/4/2011
[Member]
[Moderator]
[Microsoft_MVP]
[MVP]
Silver
|
Points: 25
0
Ok thanks madhu and venkatesh...
Thanks
Karthik
www.f5Debug.net
Venkatesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Login to post response
Latest Posts
How to get the exact property name while getting error
(0)
PDB file is not showing Line Number in dot net application hosted on server
(0)
Both Strings morethan 5 letters in length end of the words one vowel and one consonent is different
(0)
how to check Any adjacent letters transposed between two strings(ex: JOHN, JHON)
(1)
can't receive data after success login ?
(1)
Implement Multi-Tenant in Azure Logic Apps
(0)
Why ASP.Net Core 7.0 Web API showing as Connection refused?
(0)
Iterating over columns of dataframe and print as rows in Python Django
(0)
More ...