Updating my BlogEngine.NET blog to use SSL (HTTPS) from HTTP

by filip 28. October 2014 14:57

I’m using this post to document how I upgraded my blog for HTTPS.

The first thing I needed to do was to get a SSL certificate. I really didn’t feel like paying for one, so I went with a free certificate from StartSSL. Their free certificates expire after a year (I wish it was longer), so I’ll need to do this again next year.  But they work and… they’re free.

After I got my p12 certificate above, I asked my web host (Arvixe) to set everything up. It took them about 2 days (it was the weekend though, so maybe it would have been faster if it was during the week). This was pretty much the easiest part since all I had to do was to provide them with the cert, and they got it installed and set up the correct ports for HTTPS.

At this point, I could browse my site using HTTPS. I did have some security warnings, and to fix those I had to update my stylesheets with secure paths to my images. Also, I needed to update some script paths, as they were not secure either.

Finally, I added a rule into my web.config file so that all traffic always gets re-routed to HTTPS.


Web Development

Improving Google Page Speed Score for BlogEngine

by filip 22. February 2012 14:47

I was getting a 72/100 score from Google Page Speed, so I attempted to improve that a bit.

I added caching to static resources via the web config, which raised my score by about 10:

  <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
  <remove fileExtension=".mp4" />
  <remove fileExtension=".gif" />
  <remove fileExtension=".htm" />
  <remove fileExtension=".html" />
  <remove fileExtension=".jpeg" />
  <remove fileExtension=".jpg" />
  <remove fileExtension=".js" />
  <remove fileExtension=".png" />
  <remove fileExtension=".txt" />
  <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
  <mimeMap fileExtension=".gif" mimeType="image/gif" />
  <mimeMap fileExtension=".htm" mimeType="text/html" />
  <mimeMap fileExtension=".html" mimeType="text/html" />
  <mimeMap fileExtension=".jpeg" mimeType="image/jpeg" />
  <mimeMap fileExtension=".jpg" mimeType="image/jpeg" />
  <mimeMap fileExtension=".js" mimeType="application/x-javascript" />
  <mimeMap fileExtension=".png" mimeType="image/png" />
  <mimeMap fileExtension=".txt" mimeType="text/plain" />

New page score: 82/100

I then made sure that all of my custom javascript files went through the javascript handler in BlogEngine, which raised my score to by 3:

<script language="javascript" type="text/javascript" 

New page score: 85/100

I then uninstalled the syntax highlighter extension from BE. This upped my page rank by another 3.

New page score: 88/100

There's still some room for improvement, though... I want to get as close as possible to 100 :)

Tags: , , , ,

Web Development

Disqus Recent Comments, Top Commenters, and Most Discussed Widget for BlogEngine.NET

by filip 20. February 2012 18:11

After I switched to Disqus comments, I noticed that my recent comments widget no longer worked. So I wrote a new widget that adds some JavaScript to the web page which includes the recent comments (and a few other options, if desired) when using Disqus.

The widget is is available on the blogengine.net gallery website.

Known issues
-The character limit when using the combination look doesn't seem to be working. I need to look into this more, but right now it seems Disqus is ignoring the character count.

Tags: , ,

Web Development

New Comment System

by filip 17. February 2012 12:13

The blog now uses a new comment system - Disqus.

I upgraded to BE v2.5, and found various instructions on how to move to Disqus... including these.

There was one problem, however. The instructions state that on post.aspx, JavaScript needs to change to the following:

<script type="text/javascript">
    var disqus_title = '<%=Post.Title %>';
    var disqus_identifier = '<%= Post.Id.ToString() %>';
    var disqus_url = '<%= Post.AbsoluteLink %>';
    var disqus_developer = '<%= BlogEngine.Core.BlogSettings.Instance.DisqusDevMode ? 1 : 0 %>';
    (function () {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'http://<%=BlogEngine.Core.BlogSettings.Instance.DisqusWebsiteName %>.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);

However, that is not accurate and will result in errors.  The correct code needs to reference Page, and not Post.

<script type="text/javascript">
    var disqus_title = '<%=Page.Title %>';
    var disqus_identifier = '<%= Page.Id.ToString() %>';
    var disqus_url = '<%= Page.AbsoluteLink %>';
    var disqus_developer = '<%= BlogEngine.Core.BlogSettings.Instance.DisqusDevMode ? 1 : 0 %>';
    (function () {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'http://<%=BlogEngine.Core.BlogSettings.Instance.DisqusWebsiteName %>.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);

If the above is not changed, the blog will throw the following error:

page.aspx(14): error CS0120: An object reference is required for the non-static field, method, or property 'BlogEngine.Core.Post.Title.get'

One more change needs to be done if the above takes place. In archive.aspx.cs, the following line:

comments.InnerHtml = string.Format("<span><a href=\"{0}#disqus_thread\">{1}</a></span>", post.PermaLink, Resources.labels.comments);

needs to change to:

comments.InnerHtml = string.Format("<span><a href=\"{0}#disqus_thread\">{1}</a></span>", post.AbsoluteLink, Resources.labels.comments);

The change above will allow the Archive to correctly display the number of comments and reactions to each post.

Tags: , , ,

Web Development

Blogengine.NET – reCaptcha 0.93 Installation Instructions

by filip 25. February 2010 22:33

These installation instructions now apply to version 0.95

First, the linked ZIP file contains the updated files for installing the Recaptcha control.


  • Version 0.95 – Changed initial loading method to fix error that occurred in certain cases in IE. If upgrading from 0.94, you only need to replace the Recaptcha.cs file.
  • Version 0.94 – Logging fixes
  • Version 0.93 – Added logging.
  • Version 0.92 - The recaptcha will no longer get focus after it has been loaded. Install procedure is unchanged from version 0.91.
  • Version 0.91 - Changed the way that Recaptcha is verified.  It should no longer be possible to bypass the recaptcha by manually executing JavaScript on the page.
  • Version 0.9 - Initial Version


Tags: , , , , , ,

Web Development

Bloodforge Band

Looking for the Bloodforge band site? Click here.

About Filip Stanek

Death Note Pic I'm a developer at ACG in Cincinnati, OH. I like ASP.NET, Flash, and other web technologies, & enjoy playing chess, video games, etc.

Currently playing:


Month List