Freigeben über


Adding Windows Phone 7 Support to BlogEngine.NET

I love BlogEngine.NET, and I love my Windows Phone 7 mobile phone, so it goes without saying that I would want the two technologies to work together. I'm currently using BlogEngine.NET 1.6.1, but Windows Phone 7 is not supported by default. That being said, it's really easy to add support for Windows Phone 7 by modifying your BlogEngine.NET settings. To do so, open your Web.config file and locate the following section:

 <appSettings>
  <add key="BlogEngine.FileExtension"
    value=".aspx" />
  <!-- You can e.g. use "~/blog/" if BlogEngine.NET is not located in the root of the application -->
  <add key="BlogEngine.VirtualPath"
    value="~/" />
  <!-- The regex used to identify mobile devices so a different theme can be shown -->
  <add key="BlogEngine.MobileDevices"
    value="(nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)" />
  <!-- The name of the role with administrator permissions -->
  <add key="BlogEngine.AdminRole"
    value="Administrators" />
  <!--This value is to provide an alterantive location for storing data.-->
  <add key="StorageLocation"
    value="~/App_Data/" />
  <!--A comma separated list of script names to hard minify. It's case-sensitive. -->
  <add key="BlogEngine.HardMinify"
    value="blog.js,widget.js,WebResource.axd" />
</appSettings>

The line that you need to modify is the BlogEngine.MobileDevices line, and all that you need to do is add iemobile to the list. When you finish, it should look like the following:

 <add key="BlogEngine.MobileDevices"
  value="(iemobile|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)" />

You could also add support for Apple products by using the following syntax:

 <add key="BlogEngine.MobileDevices"
  value="(iemobile|iphone|ipod|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)" />

That's all there is to it. ;-]