Change the Office 2010 product key

A few days ago I received Office 2010 from work.

I installed it with the provided product key, and tried to activate it:



Unfortunately, the product key has been already activated for the maximum number of times permitted.


So I asked for a new key, I received it and I tried to change the key


After several researches, I couldn’t find an option to change this key.

I finally tried to repair the installation, so I start the office installer

and  the wanted option was here :


Choose “Enter a product key” then click on Continue


Enter your product key and click on “Continue”.

Then you cant choose if you want to install additional office options

Now it’s activated !


Incoming search terms:

  • product key office 2010
  • office 2010 activate key
  • office 2010 activation by telephone
  • office 2010 activation telephone
  • office 2010 product key has been activated maximum times
  • office 2010key
  • your product key

The IX509CertificateRequestPkcs10 InitializeFromTemplateName adventure

This week has been researches, tests and headaches to be able to make request on a Certificate Authority server from a web application.

My client has a Win server 2008 CA server for my developments

On this server I have a certificate template named “User Template”


My assignment was to request a certificate via an ASP.NET application.

After researches on how to do that, I found this blog post that helped me a lot :

In my development environment, I create a request for a certificate by using  this code

 CERTENROLLLib.CX509CertificateRequestPkcs10Class request = new CERTENROLLLib.CX509CertificateRequestPkcs10Class();
 string templateName = "User Template";
    request.InitializeFromTemplateName(CERTENROLLLib.X509CertificateEnrollmentContext.ContextUser, templateName);
 catch (Exception ex)
   log.DebugFormat("Error InitializeFromTemplateName : message {0}, inner : {1}, stack : {2}, source : {3}, target : {4} ",

And it worked just fine !

Then we moved the published solution to the staging environment, and the problems arrived . . .

It didn’t worked !

The error message said:

“CertEnroll::CX509CertificateRequestPkcs10::InitializeFromTemplateName: The requested certificate template is not supported by this CA. 0×80094800 (-2146875392)”

stack :

“at CERTENROLLLib.CX509CertificateRequestPkcs10Class.InitializeFromTemplateName(X509CertificateEnrollmentContext Context, String strTemplateName)”


We checked the security everywhere ( CA server, Certificate templates, IIS Account, …), give access to everyone on the CA, on the template, … without any success

Then, after days and hours of search and tests, I decided to re-read the method documentation :

And I noticed the second parameter description:

strTemplateName [in]
Pointer to a BSTR variable that contains the Common Name (CN) of the template as it appears in Active Directory or the dotted decimal object identifier.

I had never tried using the dotted decimal object identifier, so i give it a shot.

I retrieved the object identifier on a certificate previously created with the “User Template”

On the CA server, I had a certificate request with the template “User Template”, so I right-click on it, go to All Tasks and click on the “View attributes/Extensions. . .” menu item.



A property windows opened, I go to the Extensions tab and click on the “Certificate Template Information” item.


In the information panel, I can see the famous dotted decimal object identifier between brackets.

I copy-paste this identifier in my code :

 CERTENROLLLib.CX509CertificateRequestPkcs10Class request = new CERTENROLLLib.CX509CertificateRequestPkcs10Class();
 string templateName = "";
    request.InitializeFromTemplateName(CERTENROLLLib.X509CertificateEnrollmentContext.ContextUser, templateName);
 catch (Exception ex)
    log.DebugFormat("Error InitializeFromTemplateName : message {0}, inner : {1}, stack : {2}, source : {3}, target : {4} ",

I compiled, I tried in the development environment and it worked !!

(note: there is just a minimal change in my code since I put the “templateName” in a configuration file in order to be able to modify it)

So we moved the published solution to the staging environment,

retrieve the dotted decimal object identifier corresponding to the “User Template” on the staging CA server,

copy-pasted this identifier in the configuration file,

executed a “IISRESET” command and try to execute the application.

And it worked !

We can’t figured out why it worked in the development environment but not in the staging one while both are equals. So If anyone knows about it, please let me know.

So, don’t trust the template name and use the object identifier !

Incoming search terms:

  • CX509CertificateRequestPkcs10Class
  • ix509
  • InitializeFromTemplateName
  • ix509certificaterequestpkcs10 c#
  • Certenrolllib Template
  • IX509CertificateRequestPkcs10
  • CX509CertificateRequestCmcClass
  • TheIX509CertificateRequestPkcs10InitializeFromTemplateNameadventure
  • cx509certificaterequestpkcs10class msdn
  • CERTENROLLLib X509CertificateEnrollmentContext ContextUser

Visual Studio Default Key binding posters

Update 2015 : if you are looking for the 2012, 2013 or 2015 version : you can check this site :

The visual studio 2010 keybinding poster is available since a few weeks.

Visual C# 2010 default key bindings preview :



Shortcuts are grouped by category (debuging, refactoring, editing, navigation, …)

Here is the Visual Studio Keyboard shortcuts posters for C#:

Visual Studio 2010

Visual Studio  2008

Visual Studio 2005

Enjoy them !

Incoming search terms:

  • Visual Studio 2013 Keybinding Posters
  • Visual Studio 2012 Keybinding Posters
  • visual studio 2013 shortcuts poster
  • visual studio 2012 shortcuts
  • visual studio 2012 keybinding poster
  • visual studio 2013 default key bindings
  • visual c# 2013 keybinding reference poster
  • visual studio 2013 keybinding poster
  • microsoft visual 2103 c# default key bindings
  • microsoft visual 2012 c# default key bindings

Custom paging with Subsonic 3 and ObjectDataSource in ASP.NET

Here is how I created a paged items list in ASP.NET 3.5 using Subsonic for data access, and ASP.NET Controls for the display.

I use Subsonic with ActiveRecord and ASP.NET 3.5 SP1 webforms.

For this example, we are creating a blog post list and that the DAL is created (the data class we use is “DAL.BlogPost”).

The DAL.BlogPost object has three properties we need : CreatedOn, Subject and Body.

First step : prepare your data manager class

namespace MyBlog.BLL
   public class PostManager
     // ...

(keep in mind the namespace and the class for the nexts steps)

In this class, two methods are required,

The first returns the total number of items

public int GetPostCount()
  return DAL.BlogPost.All().Count(x => x.IsDeleted != true);

The second one returns the items contained in a defined range (start index and then nomber of elements), so this method needs to know where to start and how many items to get.

public PagedList<DAL.BlogPost> GetLastestPosts(int startRowIndex, int maximumRows)
   if (startRowIndex != 0)
     startRowIndex =(startRowIndex/maximumRows);

    IOrderedQueryable<DAL.BlogPost> yourQuery = DAL.BlogPost.All().OrderByDescending(x => x.CreatedOn);
    return new PagedList<DAL.BlogPost>(yourQuery, startRowIndex, maximumRows);

One important part to remember when using Subsonic is

if (startRowIndex != 0)
   startRowIndex = startRowIndex / maximumRows;

This conversion is necessary because subsonic and the ObjectDataSource doesn’t share the same opinion about the paging method.
Subsonic says

“I want the third page containing five elements”

ObjectDataSource says

“I want the five elements following the third element”

So the conversion is mandatory if you want a correct paging.

Second step : create the aspx page.

Declare an ObjectDataSource:

<asp:ObjectDataSource runat="server" ID="postsDataSource"
 SelectCountMethod="GetPostCount" >

Note the TypeName attribute : the value is the namespace + the class name of our datamanager class.
We set the EnablePaging attribute to true and we specify the SelectCountMethod and the SelectMethod.

We don’t need any parameters for the paging, by default the MaximumRowsParameterName and StartRowIndexParameterName are set to “maximumRows” and “startRowIndex”.
If we want other parameters names in our datamanager class, we can define them in the ObjectDataSource with these two parameters.

Add an asp ListView element

<asp:ListView runat="server" ID="postsListview"
    <asp:PlaceHolder ID="itemPlaceHolder"
         runat="server" />
    <h2><%# Eval("CreatedOn","{0:d}")%> :
     <%# Eval("Subject") %></h2>
    <br />
     <%# Eval("Body") %>
    <hr />

Set the DataSourceID attribute to the ObjectDataSource ID parameter.

Define a LayoutTemplate and an ItemTemplate with the elements we want to display.

Then add an asp datapager control in the LayoutTemplate


  <asp:DataPager ID="postsDataPager" runat="server"
      <asp:NextPreviousPagerField ButtonType="Link"
           FirstPageText="<<" PreviousPageText="<"
           ShowFirstPageButton="true" />
      <asp:NumericPagerField PreviousPageText="..."
           NextPageText="..." ButtonCount="10" />
      <asp:NextPreviousPagerField ButtonType="Link"
           LastPageText=">>" NextPageText=">"
           ShowLastPageButton="true" />

   <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />

Here is the result :

Remark about the data access method

It’s possible to avoid the start index value conversion !

Check the PagedList first constructor code (code is available on the subsonic git repository)

public PagedList(IQueryable<T> source, int index, int pageSize)
   int total = source.Count();
   TotalCount = total;
   TotalPages = total / pageSize;

   if(total % pageSize > 0)

   PageSize = pageSize;
   PageIndex = index;
   AddRange(source.Skip(index * pageSize).Take(pageSize).ToList());

As you can see, Subsonic use the Skip and the Take methods from Linq

So, you can modify the GetLastestPosts method to return a strongly typed List in place of the PagedList:

public List<DAL.BlogPost> GetLastestPosts(int startRowIndex, int maximumRows)
   return DAL.BlogPost.All().
          OrderByDescending(x => x.CreatedOn).

With this method, no more conversion needed

Incoming search terms:

  • define: net gaming-addiction
  • how to use subsonic in visual studio 2015

First use of Visual Studio 2010 : the installation

Yesterday I received a visual studio 2010 Ultimate edition from work.

I’ve already test the  express edition when it was in beta phase, but it’s not the same …

So, let’s install it !

I install it on a Fujitsu Siemens laptop with 4 GB Ram and a Intel Core 2 Duo processor (2,53 GHz) running  Windows 7 64 bit Ultimate edition.



Launch the auto run program


Loading screen


Click Next


Read and accept the license terms


Choose your installation mode : Full installation (takes more than 6 GB) or Custom installation


I choose Custom


Select the features you want :


(notice that “Microsoft SharePoint Developer Tools” are integrated)

I just don’t want Dotfuscator community to be installed, so I uncheck  it

I keep the rest because I want to test some features


Click Install

Installation running :


After less than 10 minutes, the installation asked me to restart my computer:



I click “Restart Now”


When restarting, a loading form is showing


Then the setup continue


After about 45 minutes, the setup is finished


You can choose to install the documentation, but I choose to click on the “Finish” button.


The installation windows appears :


I Click Exit

Visual Studio 2010 is now installed


The installation takes me about one hour, and no problem occurred.

Now I can launch the product





I choose my default environment settings (I used to choose Visual C# Development settings so I pick this one).


I Click on “Start Visual Studio”

First time loading form



Visual studio is up and running



Help and documentation are on the start page:

A What’s new section is available on the start page :

Some other links are available :

  • Creating application with Visual Studio
  • Extending Visual Studio
  • Community and Learning Resources


Some resources for Windows, Web, Cloud, Office,SharePoint and Data development are accessible too.


Next step : migration of a Visual studio 2008 solution !

Incoming search terms:

  • Choose Default Environment Settings
  • first developed Fujitsu Siemens laptops
  • first use of visual studio installing
  • ideal settings for visual studio 2010 on first use