Announcement

Monday, 30 June 2014

Encrypting and Decrypting connection string in .NET 4.0

Sometimes we need to store a lot of confidential data in web.config in our production environment (for examples: username/password for impersonation or for connect to database, some appSettings, etc.). And in fact there is a very important information in web.config file and it is our connection string that contains our server name, database name, user id and password. And it is not secure to store that as clear text, obviously some people on your server may have access to this file and steal your data. So we must store them in encrypted form. So how to encrypt the data in web.config file? And how to decrypt the same?

Monday, 9 June 2014

Check all check box on the click of a single check box.

Following is the code to select all the check boxes on the click of a single check box.


$("input[name='checkboxes']").click(function () {
if ($("input[name='checkboxes']").length == $("input[name='checkboxes']:checked").length) {
$("#checkAll").attr("checked", "checked");
}
else {
$("#checkAll").removeAttr("checked");
}
});

$("#checkAll").click(function () {
$("input[name='checkboxes']").attr("checked", this.checked);
});


checkboxes is the name given to all the check boxes that need to be checked on the click of a single check box.

checkAll is the ID of the single check box on the click of which all check boxes will get checked/unchecked.