Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Editing web.config while deploying

Editing web.config while deploying

Scheduled Pinned Locked Moved ASP.NET
helpcsharpvisual-studioworkspace
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nicejith
    wrote on last edited by
    #1

    Hi, While deploying a web application i have to set the new connection string in the web.config file. The code i used is given below ------ try { Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath); AppSettingsSection section = (AppSettingsSection)config.GetSection ("appSettings"); section.Settings["conString"].Value = str; // connection string WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath); config.Save(ConfigurationSaveMode.Modified); } catch (Exception ex) { } -------------------------- When i'm executing the code in the visual studio framework , it works fine. When the web.config is changed, save confirmation message appears there. But when deploying, the web.config file is not get updated permanently. As there is no error in the code no exception arises there. Any help w'l be appreciated. Thanks in advance. Regards Nicejith

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups