Joseph Michael Pesch
VP Programming

Welcome to BlogEngine.NET 2.0

by 12. November 2010 21:00

If you see this post it means that BlogEngine.NET 2.0 is running and the hard part of creating your own blog is done. There is only a few things left to do.

Write Permissions

To be able to log in to the blog and writing posts, you need to enable write permissions on the App_Data folder. If you’re blog is hosted at a hosting provider, you can either log into your account’s admin page or call the support. You need write permissions on the App_Data folder because all posts, comments, and blog attachments are saved as XML files and placed in the App_Data folder. 

If you wish to use a database to to store your blog data, we still encourage you to enable this write access for an images you may wish to store for your blog posts.  If you are interested in using Microsoft SQL Server, MySQL, SQL CE, or other databases, please see the BlogEngine wiki to get started.

Security

When you've got write permissions to the App_Data folder, you need to change the username and password. Find the sign-in link located either at the bottom or top of the page depending on your current theme and click it. Now enter "admin" in both the username and password fields and click the button. You will now see an admin menu appear. It has a link to the "Users" admin page. From there you can change the username and password.  Passwords are hashed by default so if you lose your password, please see the BlogEngine wiki for information on recovery.

Configuration and Profile

Now that you have your blog secured, take a look through the settings and give your new blog a title.  BlogEngine.NET 1.4 is set up to take full advantage of of many semantic formats and technologies such as FOAF, SIOC and APML. It means that the content stored in your BlogEngine.NET installation will be fully portable and auto-discoverable.  Be sure to fill in your author profile to take better advantage of this.

Themes and Widgets

One last thing to consider is customizing the look of your blog.  We have a few themes available right out of the box including two fully setup to use our new widget framework.  The widget framework allows drop and drag placement on your side bar as well as editing and configuration right in the widget while you are logged in.  Be sure to check out our home page for more theme choices and downloadable widgets to add to your blog.

Try Out New Features

BlogEngine now supports code syntax highlighting and HTML5 video out of the box. To add a video, click the "Insert video" button just above the post editor. Once your video is uploaded, use the following syntax to show it: [­video src="be-sample.mp4"]. Make sure to add "video/mp4" as a MIME type to your IIS.

You can add formatted code by pressing the "Insert Code" button on the post editor toolbar. Here is a small sample:

// Hello1.cs
public class Hello1
{
   public static void Main()
   {
      System.Console.WriteLine("Hello, World!");
   }
}

 

On the web

You can find BlogEngine.NET on the official website. Here you'll find tutorials, documentation, tips and tricks and much more. The ongoing development of BlogEngine.NET can be followed at CodePlex where the daily builds will be published for anyone to download.

Good luck and happy writing.

The BlogEngine.NET team

Tags: ,

BlogEngine.NET

Asp.Net GetCurrentPageName

by 10. November 2010 18:32

static public string GetCurrentPageName()
{
  System.IO.FileInfo fi = 

    new System.IO.FileInfo(HttpContext.Current.Request.Url.AbsolutePath);
  return fi.Name;
}

 

Tags:

[None]

Outlook 2007 URL Protocol Registry Entry

by 10. November 2010 14:14

Registering Outlook 2007 to a URL Protocol.zip (126.05 kb)

Contents of a registry edit file for 2007:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\outlook]
"URL Protocol"=""
@="URL:Outlook Folders"
[HKEY_CLASSES_ROOT\outlook\DefaultIcon]
@="\"C:\\Program Files\\Microsoft Office\\Office12\\OUTLOOK.EXE\""
[HKEY_CLASSES_ROOT\outlook\shell]
@="open"
[HKEY_CLASSES_ROOT\outlook\shell\open]
@=""
[HKEY_CLASSES_ROOT\outlook\shell\open\command]
@="\"C:\\Program Files\\Microsoft Office\\Office12\\OUTLOOK.EXE\" /select \"%1\""

Modified for 2010 on 64bit machine running Office on x86:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\outlook]
"URL Protocol"=""
@="URL:Outlook Folders"
[HKEY_CLASSES_ROOT\outlook\DefaultIcon]
@="\"C:\\Program Files (x86)\\Microsoft Office\\Office14\\OUTLOOK.EXE\""
[HKEY_CLASSES_ROOT\outlook\shell]
@="open"
[HKEY_CLASSES_ROOT\outlook\shell\open]
@=""
[HKEY_CLASSES_ROOT\outlook\shell\open\command]
@="\"C:\\Program Files (x86)\\Microsoft Office\\Office14\\OUTLOOK.EXE\" /select \"%1\""

Tags:

[None]

Visual Studio 2010 Resources

by 10. November 2010 13:28

The Visual Studio "Productivity Power Tools" are a set of Visual Studio addins that offer enhanced develeper experience in the IDE.  For example, there are features such as the following.  Enhanced tab well, allowing colorization of tabs by file type, alternative tab docking points (i.e. left side vertical tab set, vs. standard top horizontal).  Javascript code auto-collapse regions, similar to the auto-collapse feature on the C#/VB code behind.  Quick find, which allows a more user friendly find/replace, that works similar to a modern web page find (i.e. auto-highliting matches dynamically as you type), along with enhanced regular expression support.  These are just a few examples of some of the great enhanced features provdided in the "Productivity Power Tools". 

To view more details and download the bits, check out this web site: http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef

Tags:

[None] | Visual Studio

Windows Phone 7 Development

by 10. November 2010 13:27

Tags:

[None]

MSI Installation Error: The installer was interrupted before <product> could be installed

by 8. November 2010 21:23

Issue: When you run the msi, you get an error 'The installer was interrupted before <product> could be installed.  You need to restart the installer to try again'. 

Solution:

In order to install a web setup project on Windows Server 2008 and IIS 7, you need to install the IIS 6 Metabase Compatibility role service.

 

To install the IIS 6.0 Management Compatibility Components by using the Windows Server 2008 Server Manager

1.     Click Start, click Administrative Tools and then Server Manager.

2.     In the left navigation pane, expand Roles, and then right-click Web Server (IIS) and select Add Role Services.

3.     On the Select Role Services pane, scroll down to IIS 6 Management Compatibility.

4.     Select the check boxes for IIS 6 Metabase Compatibility and IIS 6 Management Console.

5.     Click Next from the Select Role Services pane, and then click Install at the Confirm Installations Selections pane.

6.     Click Close to leave the Add Role Services wizard.

Tags:

[None]

Sample Code Re-write with Generics

by 8. November 2010 15:18

    public string GetCampaign(string campaigncode)

    {

      System.Diagnostics.Debug.WriteLine("inside GetCampaign");

 

      // NEW

      List<campaign> camp = Crm.GetEntityList<campaign>(Crm.BuildStringQuery(

        EntityName.campaign.ToString(), "codename", ConditionOperator.Equal, campaigncode

        , LogicalOperator.And, new string[] { "campaignid", "codename", "name" }));

      return camp.Count == 1 ? camp[0].campaignid.Value.ToString() : "";

 

      // OLD

      ColumnSet cols = new ColumnSet();

      cols.Attributes = new string[] { "campaignid", "codename", "name" };

 

      ConditionExpression[] condition = new ConditionExpression[1];

      condition[0] = new ConditionExpression();

      condition[0].AttributeName = "codename";

      condition[0].Operator = ConditionOperator.Equal;

      condition[0].Values = new string[] { campaigncode };

 

      FilterExpression filter = new FilterExpression();

      filter.FilterOperator = LogicalOperator.And;

      filter.Conditions = condition; //new ConditionExpression[] {condition};

      QueryExpression query = new QueryExpression();

      query.EntityName = EntityName.campaign.ToString();

      query.ColumnSet = cols;

      query.Criteria = filter;

 

      // Retrieve the ServiceAppointments

      BusinessEntityCollection lines = Crm.GetCrmService().RetrieveMultiple(query);

 

      //retrieve into an object

 

      int NumOfLines = lines.BusinessEntities.Length;

      string campid = "";

      System.Diagnostics.Debug.WriteLine("numoflines = " + NumOfLines);

      campaign[] campretrieved = new campaign[NumOfLines];

 

      if (NumOfLines > 1 || NumOfLines < 1)

      {

        System.Diagnostics.Debug.WriteLine("more than one record matched");

        campid = "";

      }

      else

      {

        System.Diagnostics.Debug.WriteLine("found matching contact record");

        int i = 0;

        campid = "";

 

        while (i < 1)

        {

          campretrieved[i] = (campaign)lines.BusinessEntities[i];

          campid = campretrieved[i].campaignid.Value.ToString();

          i++;

        }

      }

      //System.Diagnostics.Debug.WriteLine("campid = " + campid);

      return campid;

    }

 

Tags:

[None]

Invalid postback or callback argument ASP.Net

by 4. November 2010 15:29

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

This can happen if you are binding a GridView control on page load unconditionally (i.e. it should only be bound when !Page.IsPostBack).

Tags:

ASP.Net

MS CRM Lookup Field DataValue Property JavaScript

by 3. November 2010 17:41

var lookupItem = new Array;

 

// This will get the lookup for the attribute primarycontactid on the Account form.

lookupItem = crmForm.all.primarycontactid.DataValue;

 

// If there is data in the field, show it in a series of alerts.

if (lookupItem != null)

{

   // The text value of the lookup.

   alert(lookupItem[0].name);

 

   // The GUID of the lookup.

   alert(lookupItem[0].id);

 

   // The entity type name.

   alert(lookupItem[0].typename);

 

   // The entity type code of the lookup: 1=account, 2= contact.

   // This attribute is deprecated. Use typename instead.

   alert(lookupItem[0].type);

}

 

 

Tags:

[None]

MS CRM GetBusinessEntity JavaScript SOAP Call

by 3. November 2010 17:33

window.IsNull = IsNull;

function IsNull(value) {

  return (typeof value == 'undefined' || value === null);

}

 

window.GetBusinessEntity = GetBusinessEntity;

function GetBusinessEntity(sEntityname, sAttribute, sLookupValue) {

  var xml = "" +

  "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +

  "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +

  " <soap:Body>" +

  " <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\" xmlns=\"http://schemas.microsoft.com/crm/2006/WebServices\">" +

  " <q1:EntityName>" + sEntityname + "</q1:EntityName>" +

  " <q1:ColumnSet xsi:type=\"q1:AllColumns\" />" +

  " <q1:Distinct>false</q1:Distinct>";

  if (!IsNull(sAttribute)) {

    xml +=

    " <q1:Criteria>" +

    " <q1:FilterOperator>And</q1:FilterOperator>" +

    " <q1:Conditions>" +

    " <q1:Condition>" +

    " <q1:AttributeName>" + sAttribute + "</q1:AttributeName>" +

    " <q1:Operator>Equal</q1:Operator>" +

    " <q1:Values>" +

    " <q1:Value xsi:type=\"xsd:string\">" + sLookupValue + "</q1:Value>" +

    " </q1:Values>" +

    " </q1:Condition>" +

    " </q1:Conditions>" +

    " </q1:Criteria>";

  }

  xml +=

  " </query>" +

  " </soap:Body>" +

  "</soap:Envelope>" + "";

 

  var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

  xmlHttpRequest.Open("POST", "/mscrmservices/2006/CrmService.asmx", false);

  xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2006/WebServices/RetrieveMultiple");

  xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

  xmlHttpRequest.setRequestHeader("Content-Length", xml.length);

  xmlHttpRequest.send(xml);

  return xmlHttpRequest.responseXml;

 

}

 

window.GetBusinessEntitySample = GetBusinessEntitySample;

function GetBusinessEntitySample() {

 

  var xml;

 

  // Get a specific Business Entity by Id

  xml = GetBusinessEntity('new_lkploantransactiondispotype', 'new_lkploantransactiondispotypeid', 'A73110D8-A4E6-DF11-8A19-0050568619C7');

  alert('The name of selected id search is: ' + xml.selectNodes("//BusinessEntity")[0].selectSingleNode("./q1:new_name").text);

 

  // Get a specific Business Entity by Name

  xml = GetBusinessEntity('new_lkploantransactiondispotype', 'new_name', 'Lead');

  alert('There id of the selected name search is: ' + xml.selectNodes("//BusinessEntity")[0].selectSingleNode("./q1:new_lkploantransactiondispotypeid").text);

 

  // Get all active Business Entities

  xml = GetBusinessEntity('new_lkploantransactiondispotype', 'statuscode', '1');

  var nodeList = xml.selectNodes("//BusinessEntity");

  var msg = 'There are : ' + nodeList.length + ' active entities';

  for (i = 0; i < nodeList.length; i++) {

    rsName = nodeList[i].selectSingleNode("./q1:new_name").text;

    rsGuid = nodeList[i].selectSingleNode("./q1:new_lkploantransactiondispotypeid").text;

    msg += '\r\n' + rsGuid + ": " + rsName

  }

  alert(msg);

 

  // Get all Business Entities

  xml = GetBusinessEntity('new_lkploantransactiondispotype');

  var nodeList = xml.selectNodes("//BusinessEntity");

  var msg = 'There are : ' + nodeList.length + ' total entities';

  for (i = 0; i < nodeList.length; i++) {

    rsName = nodeList[i].selectSingleNode("./q1:new_name").text;

    rsGuid = nodeList[i].selectSingleNode("./q1:new_lkploantransactiondispotypeid").text;

    msg += '\r\n' + rsGuid + ": " + rsName

  }

  alert(msg);

 

}

 

 

 

Tags:

[None]

ASP.Net Diagnostics Trace Listners (Text File and Event Log Samples)

by 1. November 2010 15:25

public static class Logging

{

 

  public static void AddTextWriterTraceListener()

  {

    string TempPath = Path.GetTempPath();

    TempPath = ConfigurationManager.AppSettings["LogPath"];

    if (!TempPath.EndsWith("\\")) TempPath += "\\";

    AddTextWriterTraceListener("UNDEFINED", TempPath

      + "Global.Logging.TextWriterTraceListener."

      + DateTime.Now.ToString("yyyyMMdd-hhmm")

      + ".txt");

  }

  public static void AddTextWriterTraceListener(string ApplicationName)

  {

    string TempPath = Path.GetTempPath();

    TempPath = ConfigurationManager.AppSettings["LogPath"];

    if (!TempPath.EndsWith("\\")) TempPath += "\\";

    AddTextWriterTraceListener(ApplicationName, TempPath

      + "Global.Logging.TextWriterTraceListener."

      + ApplicationName + "."

      + DateTime.Now.ToString("yyyyMMdd-hhmm")

      + ".txt");

  }

  public static void AddTextWriterTraceListener(string ApplicationName, string TextLogFilePath)

  {

    TextWriterTraceListener txtlog = new TextWriterTraceListener(TextLogFilePath);

    System.Diagnostics.Debug.Listeners.Add(txtlog);

  }

  public static void AddEventLogTraceListener()

  {

    AddEventLogTraceListener("Global.Logging.EventLogTraceListener.UNDEFINED");

  }

  public static void AddEventLogTraceListener(string ApplicationName)

  {

    EventLogTraceListener applog = new EventLogTraceListener("Application");

    applog.Name = ApplicationName;

    System.Diagnostics.Debug.Listeners.Add(applog);

  }

}

Tags:

[None]