Yes, you can. In ASP.NET 1.X you have to use file I/O or XML API to modify the web.config file directly. In .NET 2.0. the ConfigurationManager(for ASP.NET you should use WebConfigurationManager class) class provide methods to modify and update application's config file.
http://msdn2.microsoft.com/en-us/library/system.web.configuration.webconfigurationmanager.aspx
However, you should take care that whenever ASP.NET application's web.config file get changed, it will restart. I don't think this should happen very frequent for an server-side application.
Hope this helps.