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. problem in webconfig???

problem in webconfig???

Scheduled Pinned Locked Moved ASP.NET
databasesysadminhelpquestion
2 Posts 2 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.
  • D Offline
    D Offline
    Dotnetkanna
    wrote on last edited by
    #1

    Hi Everyone, Im writing connection in web config while user logged in.after writing sucessfully its a message showing as 'The file has been modified by the outside of the source editor. do you want to reload it.' do you want to reload. this makes stucks my application flow. is it possible to avoid that reloading the webconfig and the changes should be affect in the web config. is it possible. im using the folling code to write. Dim AppPath As String = Server.MapPath("~/web.config") Dim index As Integer = AppPath.LastIndexOf("\") If index > 0 Then AppPath = AppPath.Substring(0, index) End If Dim WebConfigFile As String = AppPath + "\web.config" ' MessageBox.Show(WebConfigFile); If File.Exists(WebConfigFile) Then Dim xmlDoc As New XmlDocument() xmlDoc.Load(WebConfigFile) Dim xmlNodelst As XmlNodeList = xmlDoc.GetElementsByTagName("connectionStrings") Dim xmlNode As XmlNode If xmlNodelst.Count > 0 Then For cnt As Integer = 0 To xmlNodelst.Item(0).ChildNodes.Count - 1 xmlNode = xmlNodelst.Item(0).ChildNodes(cnt) If xmlNode.Attributes.Count = 2 Then If xmlNode.Attributes.Item(0).Value = "SRPCONNECTIONSTRING" Then xmlNode.Attributes.Item(1).Value = "database=SRPnew;uid=srp;pwd=12345;server=kag;Connect Timeout=150;" End If End If Next End If xmlDoc.Save(WebConfigFile) End If rgrds Kanna

    N 1 Reply Last reply
    0
    • D Dotnetkanna

      Hi Everyone, Im writing connection in web config while user logged in.after writing sucessfully its a message showing as 'The file has been modified by the outside of the source editor. do you want to reload it.' do you want to reload. this makes stucks my application flow. is it possible to avoid that reloading the webconfig and the changes should be affect in the web config. is it possible. im using the folling code to write. Dim AppPath As String = Server.MapPath("~/web.config") Dim index As Integer = AppPath.LastIndexOf("\") If index > 0 Then AppPath = AppPath.Substring(0, index) End If Dim WebConfigFile As String = AppPath + "\web.config" ' MessageBox.Show(WebConfigFile); If File.Exists(WebConfigFile) Then Dim xmlDoc As New XmlDocument() xmlDoc.Load(WebConfigFile) Dim xmlNodelst As XmlNodeList = xmlDoc.GetElementsByTagName("connectionStrings") Dim xmlNode As XmlNode If xmlNodelst.Count > 0 Then For cnt As Integer = 0 To xmlNodelst.Item(0).ChildNodes.Count - 1 xmlNode = xmlNodelst.Item(0).ChildNodes(cnt) If xmlNode.Attributes.Count = 2 Then If xmlNode.Attributes.Item(0).Value = "SRPCONNECTIONSTRING" Then xmlNode.Attributes.Item(1).Value = "database=SRPnew;uid=srp;pwd=12345;server=kag;Connect Timeout=150;" End If End If Next End If xmlDoc.Save(WebConfigFile) End If rgrds Kanna

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Dotnetkanna wrote:

      'The file has been modified by the outside of the source editor. do you want to reload it.'

      You have web.config file opened in the editor and it is asking confirmation to reload when the file changes. It's not ASP.NET issue, this is how VS editor works. I don't recommend writing to web.config at runtime. When web.config file changes, application has to recycle and it will destroy current sessions. I'd use a separate configuration file other than web.config if connection strings are being updated on runtime.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

      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