Posts Tagged ‘read’

Read/Write Section from/into Web.config in

Many times, we need to read sections from web.config or write into web.config.

I have a requirement where i need to write an section in web.config that points to another config file.

Below is the code where “abc” is the section

Configuration objConfig = WebConfigurationManager.OpenWebConfiguration(“~”);
ConfigurationSection section = objConfig.Sections[“abc”];
string str = “abcdef”;

The above code will read “abc” section and write the content in str.

For Reading Appsettings from web.config, below is the code

Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); AppSettingsSection appSettings = (AppSettingsSection) config.GetSection(appSettings);

string[] appKeys = appSettings.Settings.AllKeys;

for (int i = 0; i < appSettings.Settings.Count; i++)






CRUD(Create/Insert/Update/Delete) with MVC Framework, Linq To Sql (.dbml)

June 26, 2009 1 comment

This article will explain you how to create, read, insert, update, delete operations with mvc with Linq To Sql (.dbml).

Very nice article who are beginners with mvc framework.