Although the post editor is correct in Blog Engine.NET, it comes to a headache when you want to format code snippets…

Here is the perfect solution, that will take you 10’ to setup… and hours to enjoy :

Now to paste a nicely formatted code, just copy in Visual Studio, and paste with the plug-in button in Live Writer…

image

 

And get the easy cool formatted code…

    Sub Application_OnStart()
        
        If ConfigurationManager.AppSettings("AutomaticallyEncryptConnectionStrings") Is Nothing _
        OrElse CType(ConfigurationManager.AppSettings("AutomaticallyEncryptConnectionStrings"), Boolean) = True Then
            
            ' check that web.config connection is encrypted
            Dim config As Configuration = WebConfigurationManager.OpenWebConfiguration(HttpRuntime.AppDomainAppVirtualPath)
            Dim section As ConfigurationSection = config.GetSection("connectionStrings")
            If (section.SectionInformation.IsProtected) = False Then
                section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider")
                config.Save()
            End If
        End If
                   
    End Sub

 

Enjoy !