updateing web.config
-
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)...
-
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)...
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
-
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
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"); }
-
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)...
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
-
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"); }
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
-
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
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 ?
-
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"); }
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
-
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
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)
-
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
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 ..
-
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 ?
abhijit can i have ur email so that i can send u my sample application if r intrusted in solving this ...
-
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 ?
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
-
abhijit can i have ur email so that i can send u my sample application if r intrusted in solving this ...
it is given in my profile.
cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net
-
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 ..
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/