TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Amir Krish
NA
5
1.3k
Custom Section / NameValueSectionHandler in Webconfig
Mar 15 2016 3:17 AM
I have custom section Links which I Should edit from UI. While saving I couldn't save the value of the corresponding key. It shows
"collection is read only"
error. Please help me to resolve this. Thanks in Advance.
WebConfig
<
sectionGroup
name
=
"Menu"
>
<
section
name
=
"Links"
type
=
"System.Configuration.NameValueSectionHandler"
/>
</
sectionGroup
>
C#
NameValueCollection nameValueCol = (NameValueCollection)ConfigurationManager.GetSection(
"Menu/Links"
);
var Key =
"Key"
;
var Value =
"Value"
;
nameValueCol.Set(Key, Value);
// Error: collection is read only
so I tried to remove and add the keys still it shows same error.
nameValueCol.Remove(Key);
// Error: collection is read only
nameValueCol.Add(Key, Value);
Reply
Answers (
3
)
how to write data to a text file
combo box