Zieglers

Just little about C#, .NET, SQL Server, SharePoint and SAP

Archive for October, 2008

Encrypt / Decrypt Connection Strings in web.config

Posted by zieglers on October 27, 2008

Key Maker

Key Maker

ASP.NET stores all the configuration information in plain text files called web.config and machine.config files. We store all vital information including database connection strings, user names, passwords for the databases. Thus you end up storing all sensitive information in vulnerable plain text files which is nothing but security compromise.

If you want to secure your connection strings and application settings, here is an easy way to encrypt / decrypt sections in web.config file. You can use aspnet_regiis.exe command line tool as follows:

Encrypting appSettings and connectionStrings sections in web.config :

Aspnet_regiis.exe –pef “appSettings” “<PathToWebSiteDir>” –prov “DataProtectionConfigurationProvider”

Aspnet_regiis.exe –pef “connectionStrings” “<PathToWebSiteDir>” –prov “DataProtectionConfigurationProvider” 

Decrypting appSettings and connectionStrings sections in web.config :

Aspnet_regiis.exe –pdf “appSettings” “<PathToWebSiteDir>”

Aspnet_regiis.exe –pdf “connectionStrings” “<PathToWebSiteDir>”

zieglers

Advertisements

Posted in .NET Framework, IT Stuff | Tagged: , , , , , | Leave a Comment »

Hiding Left Navigation Frame and Quick Launch Bar – MOSS

Posted by zieglers on October 20, 2008

Hi,

I just wanted to give a quick tip on how to

  • hide left navigation frame
  • hide quick launch bar
  • hide recycle bin

in MOSS pages.

There are a lot of solutions out there to above stated desired look & feel. They have all their pros and cons, of course. However, I won’t discuss any of those. I just want to share my approach. Hopefully the easiest one 🙂

Step-1: Create Alternate CSS file:

For this part, all you need to do is copy the following lines to an empty txt file and rename it to myAlternateCSS.css. First one hides Recycle Bin, second hides View All Site Content link, and third one hides the whole Left Navigation Frame. You can include/exclude any of those according to your needs. 

div.ms-quicklaunch table.ms-recyclebin {
display: none;
}

#ctl00_PlaceHolderLeftNavBar_idNavLinkViewAll {
       Visibility:hidden;
}

.ms-navframe {
 display:none;
}

Alternate CSS File

 

Step-2: Upload CSS file to any document library:

After creating necessary css file, we need to upload it to any document library so that we can provide its URL to AlternateCssUrl property of the website.

 

Step-3: Change AlternateCssUrl of the site:

Although you can do this programmatically, alternatively I want to show how we can make use of SharePoint Branding Tool. This tool is so easy to use and gives you a lot of flexibilty while,

* modifying Themes,
* modifying MasterUrl (Master Page),
* modifying CustomMasterUrl (System Master Page),
* modifying SiteLogoUrl (Site Logo),
* modifying SiteLogoDescription (Site Logo Alternative Text),
* modifying AlternateCssUrl (Custom CSS Style Sheet).

You can got it from its CodePlex site:

http://www.codeplex.com/BrandingTool

http://www.codeplex.com/BrandingTool/Release/ProjectReleases.aspx?ReleaseId=14392

After running this tool, all you need to do is to open your MOSS site, select the site you want to edit and enter the URL to css file created and uploaded above.

SharePoint Branding Tool

SharePoint Branding Tool

In the above screenshot,

Moss Server Name: Server

Document Library Name (for uploading our alternate CSS file): Styles

Alternate CSS File Name: myAlternateCSS.css

After entering Alternate CSS Url and selecting the site you want to apply the sytlesheet, simply click “Apply to Selected Sites” button, and then go to your site home page.. That’s it.. 😉

Hope it works for you 🙂

Please let me know if you have troubles applying this approach.

zieglers

Posted in IT Stuff, SharePoint | Tagged: , , , , , , , , | 2 Comments »