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. updateing web.config

updateing web.config

Scheduled Pinned Locked Moved ASP.NET
helpannouncement
13 Posts 4 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.
  • R Offline
    R Offline
    rajkumar 3
    wrote on last edited by
    #1

    hello, can any one help me in writing code to update web.config when installing web application. need to update when installation wizard is running .. (datasourse, userid,password)...

    V A 2 Replies Last reply
    0
    • R rajkumar 3

      hello, can any one help me in writing code to update web.config when installing web application. need to update when installation wizard is running .. (datasourse, userid,password)...

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      What do you mean saying Update webconfig. Explain in detail what do you want to achieve and what are your Challenges

      Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswam@its.co.za

      R 1 Reply Last reply
      0
      • V Vimalsoft Pty Ltd

        What do you mean saying Update webconfig. Explain in detail what do you want to achieve and what are your Challenges

        Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswam@its.co.za

        R Offline
        R Offline
        rajkumar 3
        wrote on last edited by
        #3

        i am using following code but its not working Protected override void OnAfterInstall(IDictionary savedState) { //base.OnAfterInstall(savedState); string server = this.Context.Parameters["DATASOURCE"]; MessageBox.Show(server); string userId = this.Context.Parameters["USERID"]; MessageBox.Show(userId); string password = this.Context.Parameters["PASSWORD"]; MessageBox.Show(password); //string newConnectionString = "User Id=" + userId + ";Password= " + password + ";Data Source =" + server + ";"; string newConnectionString = "Provider=SQLOLEDB.1;User Id=" + userId + ";Password=" + password + ";Data Source=" + server + ";"; string xmlConfigFile = ""; xmlConfigFile = Context.Parameters["INSTALLDIR"] + "web.config"; UpdateConfigFile(xmlConfigFile, newConnectionString, "wfMasterConStr"); MessageBox.Show("Updated"); }

        A N 2 Replies Last reply
        0
        • R rajkumar 3

          hello, can any one help me in writing code to update web.config when installing web application. need to update when installation wizard is running .. (datasourse, userid,password)...

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          This can be done by WebConfigurationManager Class . WAT also using the same class for its operation . Here[^] is some example. I believe you can now go ahead !!

          cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

          R 1 Reply Last reply
          0
          • R rajkumar 3

            i am using following code but its not working Protected override void OnAfterInstall(IDictionary savedState) { //base.OnAfterInstall(savedState); string server = this.Context.Parameters["DATASOURCE"]; MessageBox.Show(server); string userId = this.Context.Parameters["USERID"]; MessageBox.Show(userId); string password = this.Context.Parameters["PASSWORD"]; MessageBox.Show(password); //string newConnectionString = "User Id=" + userId + ";Password= " + password + ";Data Source =" + server + ";"; string newConnectionString = "Provider=SQLOLEDB.1;User Id=" + userId + ";Password=" + password + ";Data Source=" + server + ";"; string xmlConfigFile = ""; xmlConfigFile = Context.Parameters["INSTALLDIR"] + "web.config"; UpdateConfigFile(xmlConfigFile, newConnectionString, "wfMasterConStr"); MessageBox.Show("Updated"); }

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            rajkumar.3 wrote:

            string newConnectionString = "Provider=SQLOLEDB.1;User Id=" + userId + ";Password=" + password + ";Data Source=" + server + ";";

            Just one suggestion Raj kumar, If this is your final/ production code, Please be aware of SQL Injection BTW : "Re: dont be smart Vuyiswa Maseko" what was the reason to write this subject and why did you change that ?.

            cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

            R 1 Reply Last reply
            0
            • R rajkumar 3

              i am using following code but its not working Protected override void OnAfterInstall(IDictionary savedState) { //base.OnAfterInstall(savedState); string server = this.Context.Parameters["DATASOURCE"]; MessageBox.Show(server); string userId = this.Context.Parameters["USERID"]; MessageBox.Show(userId); string password = this.Context.Parameters["PASSWORD"]; MessageBox.Show(password); //string newConnectionString = "User Id=" + userId + ";Password= " + password + ";Data Source =" + server + ";"; string newConnectionString = "Provider=SQLOLEDB.1;User Id=" + userId + ";Password=" + password + ";Data Source=" + server + ";"; string xmlConfigFile = ""; xmlConfigFile = Context.Parameters["INSTALLDIR"] + "web.config"; UpdateConfigFile(xmlConfigFile, newConnectionString, "wfMasterConStr"); MessageBox.Show("Updated"); }

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

              rajkumar.3 wrote:

              i already wrote this piece of code but its not working. every thing cant be explain to u better u can concentrate on ur own business

              Don't be rude. If this is your attitude, I am sure you are not going to get any replies. Good luck!

              Navaneeth How to use google | Ask smart questions

              R 1 Reply Last reply
              0
              • A Abhijit Jana

                This can be done by WebConfigurationManager Class . WAT also using the same class for its operation . Here[^] is some example. I believe you can now go ahead !!

                cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

                R Offline
                R Offline
                rajkumar 3
                wrote on last edited by
                #7

                i need to update the connection string when istallation wizard is running by taking the data source name , userid and pwd ... .. .. its like before installation event or after installation event ...how to use these events ?

                R A 2 Replies Last reply
                0
                • A Abhijit Jana

                  rajkumar.3 wrote:

                  string newConnectionString = "Provider=SQLOLEDB.1;User Id=" + userId + ";Password=" + password + ";Data Source=" + server + ";";

                  Just one suggestion Raj kumar, If this is your final/ production code, Please be aware of SQL Injection BTW : "Re: dont be smart Vuyiswa Maseko" what was the reason to write this subject and why did you change that ?.

                  cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

                  R Offline
                  R Offline
                  rajkumar 3
                  wrote on last edited by
                  #8

                  http://lakshmik.blogspot.com/2006/06/aspnet-20-deployment-installer-for.html[^] i am using above code .. but my focus is not entering into following method. protected override void OnAfterInstall(IDictionary savedState)

                  1 Reply Last reply
                  0
                  • N N a v a n e e t h

                    rajkumar.3 wrote:

                    i already wrote this piece of code but its not working. every thing cant be explain to u better u can concentrate on ur own business

                    Don't be rude. If this is your attitude, I am sure you are not going to get any replies. Good luck!

                    Navaneeth How to use google | Ask smart questions

                    R Offline
                    R Offline
                    rajkumar 3
                    wrote on last edited by
                    #9

                    yeah i am sorry i was bit confused with that persons signature .. there is a link in his signature ... in fact i am bit hurry in finishing this task ..

                    V 1 Reply Last reply
                    0
                    • R rajkumar 3

                      i need to update the connection string when istallation wizard is running by taking the data source name , userid and pwd ... .. .. its like before installation event or after installation event ...how to use these events ?

                      R Offline
                      R Offline
                      rajkumar 3
                      wrote on last edited by
                      #10

                      abhijit can i have ur email so that i can send u my sample application if r intrusted in solving this ...

                      A 1 Reply Last reply
                      0
                      • R rajkumar 3

                        i need to update the connection string when istallation wizard is running by taking the data source name , userid and pwd ... .. .. its like before installation event or after installation event ...how to use these events ?

                        A Offline
                        A Offline
                        Abhijit Jana
                        wrote on last edited by
                        #11

                        when you will create web setup project , you can have option of creation UI. on that time take the connection string , userid and password and set that as I say earlier.

                        cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

                        1 Reply Last reply
                        0
                        • R rajkumar 3

                          abhijit can i have ur email so that i can send u my sample application if r intrusted in solving this ...

                          A Offline
                          A Offline
                          Abhijit Jana
                          wrote on last edited by
                          #12

                          it is given in my profile.

                          cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

                          1 Reply Last reply
                          0
                          • R rajkumar 3

                            yeah i am sorry i was bit confused with that persons signature .. there is a link in his signature ... in fact i am bit hurry in finishing this task ..

                            V Offline
                            V Offline
                            Vimalsoft Pty Ltd
                            wrote on last edited by
                            #13

                            lol :) so you thought my Signature was referring to you ?

                            Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

                            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