Edit Connection String in code and save into web.config
I am building an installer for my CMS, AdvGenCMS. The first part is adding connection string and saves it into web.config. That is doable in C#. Just like the following code:
Code
Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); | |
ConnectionStringsSection connectionStrSection = config.GetSection("connectionStrings") as ConnectionStringsSection; | |
string conntectStr = String.Format("data source={0};Initial Catalog={1};uid={2};password={3};Intergrated Security=SSPI",serverModel.ServerName,serverModel.DatabaseName,serverModel.UserName,serverModel.UserPassword); | |
if (connectionStrSection != null) | |
{ | |
if ( connectionStrSection.ConnectionStrings["AdvCMS.Data.Linq.Properties.Settings.AdvCMSConnectionString"] == null) | |
{ | |
ConnectionStringSettings setting = new ConnectionStringSettings(); | |
setting.Name = "AdvCMS.Data.Linq.Properties.Settings.AdvCMSConnectionString"; | |
connectionStrSection.ConnectionStrings.Add( | |
setting); | |
} | |
connectionStrSection.ConnectionStrings["AdvCMS.Data.Linq.Properties.Settings.AdvCMSConnectionString"].ConnectionString = conntectStr; | |
connectionStrSection.ConnectionStrings["AdvCMS.Data.Linq.Properties.Settings.AdvCMSConnectionString"].ProviderName = "System.Data.SqlClient"; | |
config.Save(); | |
} |
We can use WebConfigurationManager.OpenWebConfiguration("~") to get the whole configuration and then use config.GetSection("connectionStrings") to get the connection string section. Now, we can play around the connection string section freely.
Openclipart.org went back to normal now
My last post mentioned Openclipart.org is down, but now I checked it again. The server is up again.
This website went back to normal now.
Openclipart.org is down
I found Openclipart.org is down now. Previously, I was still able to access via http://openclipart.org/. That is not working this times, does anyone have a solution?
Stayed At visual studio 2010
Windows 8 is released for about a month. Moreover, there is a new version of Visual Studio for Windows 8. But I have a few amount codes in WPF and Winforms. I will be still with these projects for a little while. Moreover, nowadays, the trend is moving toward web apps and mobile apps. That is the reason, I put rest of my effort to build asp.net websites and android app. Get myself into Metro UI app is not very attractive unless Windows 8 is more popular in the tablet market. Thus, I will stay in visual studio 2010 for a little while.
#
Afer I added The Colorbox as the lightbox jquery plug-in one of my projects. Yes, I added the reference of js and css files in my html file.
Code
$(".iframelink").colorbox({ iframe: true, width: "80%", height: "80%" }); |
I added the javascript to active the link. But when I clicked the link which calls a lightbox, there is an error,#