Sunday, December 25, 2011

Prerequisites for installing SQL Server 2012 RC0

If you are interested in installing SQL Server 2010 RC0, there are a few prerequisites for installing it that may not be readily obvious at first:


  1. In order to install SQL Server 2012 RC0, you will need to install this on either Windows 7 SP1 or Windows Server 2008 R2 SP1
  2. If you have an existing installation of Visual Studio 2010 on your machine, you will need to apply Visual Studio 2010 SP1 before being able to proceed with the installation of SQL Server 2012 RC0
Therefore, if your current development environment is not running the latest service packs, unfortunately, you will have to apply these before giving SQL Server 2012 RC0 a whirl!

Friday, December 16, 2011

Jetbrains Resharper Developer Productivity Tool

I have been using Jetbrains Resharper since the release of Visual Studio.Net 2003.

The primary feature I used at that time was the automatic curly brace and semicolon completion for C# (which is not still available out-of-the-box for Visual Studio 2010).

Aside from that very convenient feature, there are several benefits to using Resharper in recent releases.


  1. Resharper now ships with a set of default style rules that allow you to control the naming conventions and standards within your code.  If you create code that violates those standards, Resharper offers suggestions on how to correct these issues.
  2. Resharper provides an easy way to remove unused using directives in C#
  3. Resharper provides the handy feature of being able to convert string concatenations to using string.Format instead
  4. Resharper provides suggestions for class and method modifiers (such as public, private, internal etc.)
  5. Resharper provides suggestions on when to use the var keyword rather than strongly typed variables.
  6. Resharper also supports Solution Wide Analysis of a Visual Studio solution by pointing out errors ranging from C# code errors to HTML and JavaScript errors.  However, this should be used with caution since this process runs in the background and is very processor and memory intensive.
  7. Resharper provides another very handy feature of being able to collapse if/then statements into statements using the C# ternary (?) operator.
  8. Finally, Resharper provides one of my very favorite and extremely useful features while working in C# of allowing you to view the top of a statement block when selecting an ending curly brace.  This is especially useful when your are scrolling through a screen and the top of the statement block may not be visible within the confines of the Visual Studio screen area.
Of course, there are many other features that are available in Resharper and the Jetbrains team continues to enhance the features and functionality included in Resharper with every release.

If the feature set I have described above interest you, you should try out Resharper for yourself and see if it improves your overall productivity!

Wednesday, December 14, 2011

Re-targeting Unit Test projects

If you ever created Unit Test projects in Visual Studio 2010 prior to the release of SP1, you will probably remember that you could only create Unit Test projects that targeted .Net Framework v. 4.0 for your Unit Test projects.

Unfortunately, this caused all types of issues with assembly handling and namespace resolution since assembly references differ between .Net Framework v. 3.5 and .Net Framework v. 4.0.  It made no sense to create Unit Test projects that targeted .Net Framework v. 4.0 when your base assemblies were executing on .Net Framework v. 3.5.

Needless to say, the Microsoft Visual Studio team reverted their original decision and once again allowed creation of Unit Test projects that could target the same version of the framework as the base assemblies.

However, if you have a reasonably old Unit Test project which you are now considering for re-targeting after the application of Visual Studio 2010 SP1, you may get the error message dialog below:

As it turns out this article link actually lands you here: http://msdn.microsoft.com/library/gg601487.aspx#re-targeting35AdditionalSteps

Basically, it requires to make some manual changes to the devenv.exe.config file in order to support Unit Test project re-targeting.

After you make the changes and re-load Visual Studio 2010, you should now be able to re-target your Unit Test projects!

Monday, December 12, 2011

Telerik JustCode Developer Productivity Tool

While many of the features that are present in Telerik JustCode are very similar to features in various other Visual Studio Extensions, one of my favorite features by far is the background compilation feature.

If you are familiar with common build/debug operations within Visual Studio, you probably know that refactoring operations often require a re-build/re-compile operation before any errors appear in the Error List in the Visual Studio IDE before proceeding with additional refactoring operations.

Fortunately, though, Telerik JustCode is able to perform this compilation while you are editing code directly within the Visual Studio IDE.
This unique feature performs a background compilation of the Visual Studio project/solution as you are continuing to work within the Visual Studio IDE (with no noticeable performance degradation).  Therefore, while you are performing refactoring operations (such as moving a method from one class to another), you can easily click on the Status Bar to see the current errors in the solution and proceed to fixing them without having to perform a complete re-compile of the project or solution!

The other side effect benefit from this background compilation operation is that you are much more easily able to detect unused variable declarations within your code and thereby able to remove them.

In addition, this feature seems to significantly reduce overall build time when you actually wish to execute a debug session for your application!


Thursday, December 8, 2011

LinqPad for SharePoint

If you currently use LinqPad, which you can download from LinqPad, you can now use Linq to SharePoint to test out your Linq queries with a LinqPad for SharePoint driver.

You can download this driver from CodePlex here:  http://linqpadsp2010driver.codeplex.com

Enjoy!

Monday, December 5, 2011

Visual Studio Extensions for Developer Productivity

There are a whole host of competitors for building extensions for Visual Studio.  There is particularly fierce competition in the area of Developer Productivity Tools.

There are numerous vendors in this space, but I will only go through the most notable ones here:

Jetbrains Resharper: http://www.jetbrains.com/resharper/

DevExpress CodeRush and Refactor! Pro: http://devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/

Telerik JustCode: http://www.telerik.com/products/justcode.aspx

AxTools CodeSmart: http://axtools.com/products-codesmart-vsnet.php

Whole Tomato Software Visual Assist X: http://www.wholetomato.com/

MZ-Tools: http://www.mztools.com/index.aspx

I have used nearly all of these tools (excluding MZ-Tools) and I will review each of these individual tools in turn in future posts.


Monday, November 21, 2011

Abstract Factory Design Pattern

This is some sample code from C# 3.0 Design Patterns by Judith Bishop outlining the Abstract Factory Design Pattern:

using System;

namespace AbstractFactoryPattern {
  //  Abstract Factory        D-J Miller and Judith Bishop Sept 2007
  //  Uses generics to simplify the creation of factories
  
  interface IFactory<Brand>
    where Brand : IBrand {
    IBag CreateBag();
    IShoes CreateShoes();
  }

  // Conctete Factories (both in the same one)
  class Factory<Brand> : IFactory<Brand>
    where Brand : IBrand, new() {
    public IBag CreateBag() {
      return new Bag<Brand>();
    }

    public IShoes CreateShoes() {
      return new Shoes<Brand>();
    }
  }

  // Product 1
  interface IBag {
    string Material { get; }
  }

  // Product 2
  interface IShoes {
    int Price { get; }
  }

  // Concrete Product 1
  class Bag<Brand> : IBag
    where Brand : IBrand, new() {
    private Brand myBrand;
    public Bag() {
      myBrand = new Brand();
    }

    public string Material { get { return myBrand.Material; } }
  }

  // Concrete Product 2
  class Shoes<Brand> : IShoes
    where Brand : IBrand, new() {
      
    private Brand myBrand;
      
    public Shoes() {
      myBrand = new Brand();
    }

    public int Price { get { return myBrand.Price; } }
  }

  interface IBrand {
    int Price { get; }
    string Material { get; }
  }

  class Gucci : IBrand {
    public int Price { get { return 1000; } }
    public string Material { get { return "Crocodile skin"; } }
  }

  class Poochy : IBrand {
    public int Price { get { return new Gucci().Price / 3; } }
    public string Material { get { return "Plastic"; } }
  }

  class Groundcover : IBrand {
    public int Price { get { return 2000; } }
    public string Material { get { return "South african leather"; } }
  }

  class Client<Brand>
    where Brand : IBrand, new() {
    public void ClientMain() { //IFactory<Brand> factory)
      IFactory<Brand> factory = new Factory<Brand>();

      IBag bag = factory.CreateBag();
      IShoes shoes = factory.CreateShoes();

      Console.WriteLine("I bought a Bag which is made from " + bag.Material);
      Console.WriteLine("I bought some shoes which cost " + shoes.Price);
    }
  }

  static class Program {
    static void Main() {
      // Call Client twice
      new Client<Poochy>().ClientMain();
      new Client<Gucci>().ClientMain();
      new Client<Groundcover>().ClientMain();
    }
  }
} 
 
Based on the above code, we can readily notice that this does not differ significantly from the 
Factory Method Design Pattern in that it is still heavily reliant on Interfaces.  In this case,
however, the usage of C# Generics has further simplified the process of specifying
concrete class implementations, thus allowing a Class Name to be specified as a 
parameter rather than an actual concrete class instance.
The Abstract Factory Design pattern primarily differs from the Factory Method class in that
the individual classes or "factories" are responsible for handling the business
logic for processing, whereas in the Factory Method Design Pattern, this is wholly contained
within the logic of a single method.  In addition, the Abstract Factory Design Pattern
is leverage to create a group of related products (in this case, bags and shoes) whereas
the Factory Method also concerned itself with the instantiation of only a single
class based on a common Interface.  Therefore, the abstraction in this case is to the 
level of encapsulating the internal details and logic of creating a "factory" 
rather than creating a specific single class instance.

Factory Method Design Pattern

This is some sample code from C# 3.0 Design Patterns by Judith Bishop outlining the Factory Method Design Pattern:

using System;
  using System.Collections;

  class FactoryPattern {
  
  // Factory Method Pattern       Judith Bishop 2006
  //  Example of exporting from different suppliers
    
  interface IProduct {
    string ShipFrom();
  }

  class ProductA : IProduct {
    public String ShipFrom () {
      return " from South Africa";
    }
  }
  
  class ProductB : IProduct {
    public String ShipFrom () {
            return "from Spain";
    }
  }

  class DefaultProduct : IProduct {
    public String ShipFrom () {
            return "not available";
    }
  }

  class Creator {
    public  IProduct FactoryMethod(int month) {
      if (month >= 4 && month <=11)
        return new ProductA();
      else 
      if (month == 1 || month == 2 || month == 12)
        return new ProductB();
      else 
        return new DefaultProduct();
    }
  }
  
    static void Main() {
      Creator c = new Creator();
      IProduct product;
        
      for (int i=1; i<=12; i++) {
        product = c.FactoryMethod(i);
        Console.WriteLine("Avocados "+product.ShipFrom());
      }
    }
  }

So by looking at the code, you can probably get a good feel for what the code is trying to accomplish.

There are 3 products which all need to implement common shipping functionality but need to ship from 3 different locations. Therefore, this is a perfect candidate for implementing an Interface across all of the class implementations. By implementing a common Interface, the classes can easily be swapped for one another (called "polymorphism"). Since all of the classes are interchangeable, there only needs to be a set of criteria which dictates which class is actually instantiated and utilized within the Main method.

In this case, the Factory method is responsible for accepting that parameter (in this case, the month) and then returning the appropriate instance of the class based on the internally developed logic which has been conveniently encapsulated into a single method. The Main method can now simply be oblivious to the actual instance of the class that is required. The class is returned as an instance of an Interface and the only parameter that is required to be known is the month. The Factory Method in this manner also assists in the principles of encapsulation and decoupling.

Thursday, November 17, 2011

Converting from one version of Visual Studio version to another

If you work with a large number of developers that may have different versions of Visual Studio on their local workstations, you may have to constantly deal with version conflicts in projects and solutions.

Fortunately, a tool exists for allowing you to convert from versions of Visual Studio 2010 back to versions of Visual Studio 2008 or Visual Studio 2005 (with the disclaimer that all functionality will not be guaranteed to work by switching between the various versions).  You can download the tool here: http://www.emmet-gray.com/Articles/ProjectConverter.htm

Unfortunately, the tool is written entirely in VB.Net which makes it difficult to work with if your preferred development language is C# (like me).

I used a tool called Instant C# from Tangible Software Solutions (http://tangiblesoftwaresolutions.com/Product_Details/Instant_CSharp.html) to convert the VB.Net source over to C#.





In addition, I heavily refactored the code to make it more flexible for future Visual Studio support and additional future features and capabilities:
http://vsprojectconverter.codeplex.com

Working with 3rd party assemblies in Sandboxed solutions

If you are attempting to utilize 3rd party assemblies in SharePoint Sandboxed Solutions, you may encounter error messages when attempting to deploy your SharePoint project.

The reason this does not work is because Sandboxed Solutions run in partial trust, therefore, any assemblies that you utilize need to support a partial trust model.

If you are fortunate enough to have the source code for the assembly, then you can add the following attribute to the AssemblyInfo.cs file (in the case of C# source code): [assembly:AllowPartiallyTrustedCallers].  You can read more about this attribute here:  http://support.microsoft.com/kb/839300
You can then re-compile the source code and use the resultant assembly within your Sandboxed Solution. 

NOTE: When you add the Reference to your Visual Studio project, make sure that the property for "Copy Local" is set to True.  This will force the assembly to be copied to your bin directory and thereby include it in the WSP (SharePoint Solution Package) for deployment to your Site Collection.

As you can probably guess, if you do not have the source code to the assembly and it is not already marked to support partial trust, you are out of luck and will have to deploy your solution as a Farm Level Solution instead.  This is extremely unfortunate since online hosted solutions of SharePoint such as SharePoint Online/Office 365 only support Sandboxed Solutions--thereby making more complex application development solutions impossible. 



Friday, October 7, 2011

ADFS v. 2.0 and Windows Server 2008 R2

If you need to configure ADFS v. 2.0 for use in Claims-based authentication scenarios, interestingly enough, ADFS v. 2.0 DOES NOT come pre-installed with Windows Server 2008 R2--even after the release of SP1.

Therefore, you will not be able to install ADFS as part of the Server Roles that come with Server Manager.  Instead, you will have to separately download the release of ADFS v. 2.0 and install and configure it separately.

You can download the release of ADFS v. 2.0 from here: http://www.microsoft.com/download/en/details.aspx?id=10909

There is also an update rollup for ADFS v. 2.0 available which can be downloaded from here: http://support.microsoft.com/kb/2607496

In addition, this is an excellent article on configuring ADFS v. 2.0: http://www.sysadminsblog.com/microsoft/installing-and-configuring-adfs-2-0/

Thursday, October 6, 2011

SQL Server 2008 R2 Express with SP1

If you are like me, you probably avoid installing service packs like you try to avoid the plague.  Therefore, whenever possible, I try to install "slipstreamed" or integrated products that already include the service pack or any necessary updates/patches etc. that are required for an installation.

Unfortunately, certain platforms such as SQL Server 2008 R2 Express with SP1 are not so easy to find through a Google search or even a Microsoft MSDN search.  If you look on the main Microsoft SQL Server Express page, there is no easy way to tell if you are downloading the RTM release of SQL Server 2008 R2 Express or the release that includes SP1: http://www.microsoft.com/sqlserver/en/us/editions/express.aspx

Therefore, for your convenience, I have included a link to the download for the SQL Server 2008 R2 Express with SP1 installation here: http://www.microsoft.com/download/en/details.aspx?id=26729

Installing and configuring ADFS v. 1.0

If you need to install and configure ADFS (Active Directory Federation Services) to use in scenarios such as Claims Based Authentication, you will need to know several things before installing and configuring ADFS.

  1. You will need to install and configure a Domain Controller/Active Directory prior to installing ADFS.  If you are simply setting up a test environment, you can install the domain controller with Active Directory on the same server as your ADFS installation.
  2. Active Directory requires SSL certificates to be installed in IIS in order to function properly.  When stepping through the ADFS installation wizard, you will have the option to create self-signed certificates. 
  3. After re-booting from an installation of ADFS, you will get an error message/error icon next to the ADFS role in Server Manager.  This is caused by the usage of the self-signed SSL certificates.  In order to resolve this issue, you will have to do the following:
    • Open up the IIS Manager console
    • Open up Server Certificates
    • For the individual Server Certificates that were created through the ADFS installation wizard, right click on the certificates and select View.
    • Once you are able to view the certificate, click on the Details tab.
    • On the Details tab, you should see a button on the bottom of the screen which states "Copy to File"
    • Click on the Copy to File button to export the server certificate.
    • Follow the wizard dialogs to export and save the server certificate.
    • Once both certificates have been successfully exported, you can right click on the certificates and select "Install Certificate"
    • When proceeding through the certificate installation dialogs, select the radio button for "Place all certificates in the following store"
    • You will then want to browse to the location of the "Trusted Root Certification Authorities"
    • Complete the Install Certificate wizard to store the server certificate in this location. 
    • Repeat this step for the other server certificate as well.
    • Once again re-boot the server.
    • When you open up Server Manager after the re-boot, the error message/error icon next to the ADFS role should have disappeared.
  4. Verify that you can now successfully access the following Url in a browser without getting a server certificate error message: https://<fully qualified server Url>/adfs/fs/federationserverservice.asmx
  5. If you are able to navigate to this Url and view the available methods on the Web Service, you have successfully configured ADFS for use!

Wednesday, October 5, 2011

Determining the underlying technology of a website

If you have ever looked at a website and wondered how it was built and which technology or set of technologies were used to build the website, a great site which decomposes the site and allows you to review many of these details is Built With.

You can visit the site here: http://builtwith.com

The nice thing about this tool is that you can enter any Url and it will not only decompose server side technologies such as ASP.Net, but it will even decompose such things as use of Content Management Systems (CMS) and even JavaScript libraries such as jQuery!!  Very cool stuff!

Friday, September 30, 2011

Setting up a domain controller in a virtual machine

If you need to set up any variety of Windows Server Applications such as Active Directory Federation Services, SharePoint, Windows Server Update Services and a whole variety of other applications, there is a high likelihood that you will need to set up a domain controller.

If you are setting up a domain controller on a home network where you have a router performing all of your DHCP operations, it is likely that you will not want to set up your domain controller to act as your DHCP server as well.  Therefore, the easiest thing to do is to simply set aside a block of static IP addresses that you can use to assign for your virtual environments.

Once you have done that, you should be able to follow these steps to install and configure your domain controller.  For this example, I have installed Windows Server 2008 R2 and using this OS as my base configuration.  For ease of use, I also use VMWare Workstation or VMWare Player to build and configure my virtual machines.

  1. Open up the Network Adapter settings and assign a static IP address to the IPv4 configuration from the block of static IP addresses that you have set aside.
  2. If you need to enter a default gateway, configure the default gateway as the IP address of your router (usually something like 192.168.0.1)
  3. If you need to enter a Primary DNS server, you can enter the IP address of your router as well (such as 192.168.0.1)
  4. Once you have entered your settings, click OK to save all of your network adapter settings.
  5. If everything is configured correctly, you should still be able to access the Internet from within your virtual machine using a web browser.
  6. If you have customized or disabled any Windows Services, you will need to ensure that the appropriate Windows services are enabled and started:
    1. Remote Procedure Call (RPC) Service
    2. Remote Registry Service
  7. Now, at the run command, you can run dcpromo
  8. This should now initiate the process to install the Active Directory binaries on your machine as well as launch the Active Directory configuration wizard. 
  9. While configuring Active Directory through the configuration wizard, you will be prompted for setting up a new forest or using an existing forest.  Since you probably do not have an existing domain infrastructure in place, you will want to create a new forest.  In terms of forest compatibility, I would recommend either configuring the compatibility to either Windows Server 2008 or Windows Server 2008 R2 compatibility mode.
  10. After proceeding through several other configuration steps, you will be prompted to configure DNS on the server.  You can allow the domain controller to be configured as its own DNS Server.  This will effectively modify the network adapter settings to include 127.0.0.1 as the Primary DNS Server IP Address.
  11. If there were no hiccups in the configuration wizard process, you should be done with successfully configuring a domain controller within your virtual machine!

Wednesday, September 28, 2011

Deploying SharePoint 2010 Language Packs

If you want to have multilingual support in your SharePoint 2010 site, you will need to deploy the SharePoint 2010 Language Packs.

You can download the SharePoint 2010 Language Packs from here:

SharePoint Server Language Packs
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=3411

SharePoint Foundation Language Packs
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=4731

One of the key points to note when downloading and installing the language packs is that the default language for downloading the language packs is English.  Therefore, if you simply download the language packs from the respective links, you will  not get the required functionality in your SharePoint site to support multiple languages.  Instead, when you download the individual language packs, you must actually select a different language for downloading the language pack prior to downloading.  For example, if you wish to download the language pack for Spanish, you would have to change the language on the download screen to Spanish.  Changing the language will actually change the resultant download Url such as this one for Spanish:
http://www.microsoft.com/downloads/es-es/details.aspx?familyid=046f16a9-4bce-4149-8679-223755560d54&displaylang=es

You will have to proceed with downloading each of the language packs for each of the languages you wish to support in the application.

Once you have downloaded all of the required languages, you will have to install the individual language packs on your SharePoint instance(s).  This process will also require you to re-run the SharePoint Configuration Wizard tool as part of the installation process. 

Once the installation process is complete, you will then have a new option under Site Settings called Language Settings which will allow you to configure the various installed languages for your SharePoint environment.  Configuring the Language Settings allows an end-user to change their Display Language to an alternative language such as French, German, Spanish etc.

If that is working, you have successfully deployed SharePoint Language Packs!  You can now begin to utilize multilingual variations of a SharePoint site.

Tuesday, September 27, 2011

Firefox v. 7.0 released!

It seems that Mozilla Firefox is now attempting to keep pace with the rapid development and release cycle of Google Chrome and they have recently released v. 7.0 after having released v. 6.0 only several months earlier.

As with all releases of Firefox, it may take several months before the 3rd party plug-in support catches up with the most recent release of Firefox, which may slow the adoption rate of the latest release of the browser.  Of course, if Mozilla Firefox keeps up this fast and furious pace, 3rd party vendors may not be able to keep up at all leaving hundreds of thousands of users with previous versions of the browser in order to maintain plug-in compatibility support.

The improvements in v. 7.0 over the prior release of v. 6.0 remain to be seen.  Only time will tell as to whether or not this new strategy adopted by Mozilla Firefox will be a successful strategy in reducing or diminishing the rapid adoption of Google Chrome as an alternative browser to both Microsoft Internet Explorer as well as Mozilla Firefox.

Saturday, September 24, 2011

Adobe Offline Installers

If you do not want to install Adobe Reader or any of the various Adobe applications via their online Web Installer, you can download their corresponding offline installers simply by using an FTP client such as FireFTP and connecting to ftp.adobe.com.  You can look in the pub directory for the various releases of their software products.

In addition, you can browse the directory structure for the Adobe Installer versions in the Firefox Web Browser as well.

For Adobe version 10.0, the Url is the following:
ftp://ftp.adobe.com/pub/adobe/reader/win/10.x

For previous and potential future versions of Adobe Reader, you can simply use the base Url:
ftp://ftp.adobe.com/pub/adobe/reader/win/

In addition, here are some direct links to the the Adobe Reader X Offline installers:
http://www.ghacks.net/2010/11/22/adobe-reader-x-offline-installers/

Wednesday, September 7, 2011

Deleting individual Internet Explorer Cookies

If you still use Internet Explorer (mostly because you are forced to do so for numerous websites), then there is a high probability that, like me, you are extremely frustrated with Internet Explorer's lack of ability to view and delete individual cookies on the machine.  This feature is missing even in Internet Explorer 9, while it has been present in alternative browsers such as Google Chrome and Mozilla Firefox for a very long time.

Of course, if you visit certain banking websites such as Chase.com nowadays, these websites require the presence of a cookie on your machine in order to verify that you are truly who you say you are.  If that cookie is not present on your machine, you have to go through this tedious process of re-verifying your identity before you can log in once again.  Needless to say, deleting all cookies on your system is NOT an option. 

Fortunately, though, some clever developers have created a tool to allow users like us the ability to easily view and delete individual cookies on our machine in a manner similar to Mozilla Firefox and Google Chrome.

The tool is called IE Cookies View and you can find it available for download from CNET here:
http://download.cnet.com/IECookiesView/3000-2381_4-10457038.html

Alternatively, you can review more information about the tool and download it directly from their website here: http://www.nirsoft.net/utils/iecookies.html

Enjoy!

Sunday, September 4, 2011

LoaderExceptions Error Message

I was recently deploying my web application project which contained the latest version of the Entity Framework (v. 4.1) to a hosting provider and was faced with the following error message:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

After doing a significant amount of digging, I came across this article on how to view the details of the error message:

http://weblogs.asp.net/kencox/archive/2010/08/24/fed-up-with-system-data-metadata-edm-objectitemassemblyloader.aspx

Unfortunately, the sample code provided was in VB.Net, which did not offer much value to me since I wanted it in C#.

Fortunately, I was able to use an online translator and came up with the resultant C# replacement code:

protected void Application_Error(object sender, EventArgs e)

{

StringBuilder sb = new StringBuilder();

Exception objErr;

objErr = Server.GetLastError().GetBaseException();

Server.ClearError();

if (objErr is ReflectionTypeLoadException)

{

ReflectionTypeLoadException reflerror = default(ReflectionTypeLoadException);

reflerror = (ReflectionTypeLoadException)objErr;

foreach (var ex in reflerror.LoaderExceptions)

{

sb.AppendLine(ex.Message);

}
//foreach

}

sb.AppendLine(
"<b>Source:</b>" + Request.RawUrl);

sb.AppendLine("<br><b>Browser:</b>" + Request.UserAgent);

sb.AppendLine("<br><b>IP:</b>" + Request.UserHostAddress.ToString());

sb.AppendLine("<br><b>UserID:</b>" + User.Identity.Name);

sb.AppendLine("<hr><br><b>Error in: </b>" + Request.Url.ToString());

sb.AppendLine("<br><b>Error Message: </b>" + objErr.Message.ToString());

sb.AppendLine("<br><b>Stack Trace: </b><br>" + objErr.StackTrace.ToString());

Response.Write(sb);

}

I was finally able to determine the cause of my assembly loading error message and upload the required assemblies!

Sunday, August 28, 2011

App_Browsers fix for .Net 2.0 and .Net 4.0

If you have not yet verified your ASP.Net website for compatibility with the latest versions of several browsers including Firefox 5 or Firefox 6 (and perhaps even Internet Explorer 10), you may want to do so now.

As it turns out, there is a defect in both the .Net 2.0 and .Net 4.0 Framework which does not support the latest releases of these browsers in their current browser definitions.

Fortunately, Microsoft has released a fix in the form of NuGet Packages that you can apply to your website now to remedy the situation.

You can read more about the issue here: http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx

Wednesday, August 24, 2011

Useful Team Foundation Server Tools

Now that Team Foundation Server 2010 has increased in popularity, there have been a number of newly released tools to support common tasks within Team Foundation Server.  Some of the free tools available from Microsoft are the following:

  1. Team Foundation Server Power Tools: http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f
  2. Team Foundation Server MSSCCI Provider 2010: http://visualstudiogallery.msdn.microsoft.com/bce06506-be38-47a1-9f29-d3937d3d88d6
  3. Team Foundation Server Build Extensions Power Tool: http://visualstudiogallery.msdn.microsoft.com/2d7c8577-54b8-47ce-82a5-8649f579dcb6
  4. Microsoft Team Foundation Server 2010 MOSS Configuration Tool: http://visualstudiogallery.msdn.microsoft.com/db469790-5e3e-42f3-906e-411a73795a1b?SRC=Featured
  5. Versioned TFS 2010 Build: http://visualstudiogallery.msdn.microsoft.com/282ce3b4-93da-47ef-aca9-4aee41172e7a
  6. TFS Auto Shelve: http://visualstudiogallery.msdn.microsoft.com/080540cb-e35f-4651-b71c-86c73e4a633d
  7. TFS Rollback User Interface: http://visualstudiogallery.msdn.microsoft.com/2f3bb953-69d2-4419-8203-12868bea49a9
  8. Team Foundation Server Integration Tools: http://visualstudiogallery.msdn.microsoft.com/f854dd59-8eeb-4673-8d9a-ae012989bfa2

Slipstreaming updates and service packs into SharePoint 2010

Now that Service Pack 1 for SharePoint 2010 has been released, you are probably anxious to be able to install a "fresh" installation of SharePoint 2010 with SP1 so that you can avoid the installation hassle of first installing the RTM release and then subsequently installing SP1 and any other cumulative updates.

Fortunately, there is a relatively easy method to be able to slipstream SP1 and other cumulative updates into SharePoint Server which closely follows the Updates method followed by Office 2010.

You can read more about the process of slipstreaming updates into SharePoint 2010 here:
http://blogs.msdn.com/b/ronalg/archive/2011/07/11/slipstream-sharepoint-2010-sp1-and-language-packs-w-sp1-into-rtm.aspx

SelfSTS Tool

If you have used the Windows Identity Foundation SDK, you have probably seen how easy it is to develop an STS project from within Visual Studio.

However, if you want to set up an STS rather easily and you do not have Visual Studio readily available, the SelfSTS tool makes it rather quick and simple to create an STS for your ASP.Net or SharePoint application.

You can download the SelfSTS tool from here: http://archive.msdn.microsoft.com/SelfSTS

Sunday, August 21, 2011

Creating an ERD Commander Bootable CD/DVD

If you have ever been locked out of your computer and you need to get back into your system, you will need a tool such as LockSmith.

Fortunately, that tool ships with the Microsoft Desktop Optimization Pack.  If you are a Microsoft Partner or Volume License customer, you should have access to download this through your MSDN Subscription Downloads.

Once you have downloaded and installed the latest version of the Microsoft Desktop Optimization Pack, you will need to proceed with installing it.


  1. To get the functionality to create the ERD Commander media, you will need to install the Diagnostics and Recovery Toolset
  2. Select the appropriate platform for the Diagnostics and Recovery Toolset that you wish to recover such as Windows XP, Windows Vista/Windows Server 2008 and Windows 7/Windows Server 2008 R2.  In addition, you will have to choose which processor specific platform you wish to utilize such as 32-bit or 64-bit.
  3. Once you have installed the Diagnostics and Recovery Toolset, you will get a Programs menu option for ERD Commander Boot Media Wizard
  4. Once you select that option, you will be prompted for a copy of the appropriate platform media.
  5. Once you enter the path to the appropriate media, it will begin extracting the files to create the boot media.
  6. On the following screen, it will ask for the program features that you wish to include in the bootable media.  
  7. If you include the Crash Analyzer, you will additionally be prompted for the location of the Debugging Tools for Windows which can be obtained from the Windows SDK.  The home page for the Debugging Tools for Windows can be found here: http://msdn.microsoft.com/en-us/windows/hardware/gg463009
  8. If you do not wish to include the Crash Analyzer (for example, you are just using the LockSmith functionality), you can remove it and you will not be prompted for the location of the Debugging Tools for Windows.
  9. It will then proceed to create the bootable media.
  10. Once the bootable media is created, it will prompt for a location to store the ISO image.
  11. Once the ISO image has been created, it will also provide you with the option to burn the ISO image to either CD or DVD media.
  12. If you simply need to use the ERD Commander Boot Media for a virtual machine, you can skip this step.
  13. After you Finish the wizard, the temporary files will be removed and you will be left with your ERD Commander Bootable media that you can then use for booting the target system!

Friday, August 19, 2011

Building a SharePoint 2010 Development Virtual Machine

If you are planning on installing SharePoint 2010 on a Virtual Machine to be used for development, you will want to install numerous things inside of the Virtual Machine in order to be able to utilize all of the various features and functionality within the SharePoint environment.

Below I have provided a checklist of the items you will want to install within this development virtual machine:
  1. Windows Server 2008 R2 with SP1
  2. SharePoint 2010 Enterprise Edition with SP1
  3. SQL Server 2008 SP2
  4. SQL Server 2008 R2 Management Tools
  5. Office 2010 x64 with SP1 (include InfoPath Visual Studio for Applications)
  6. SharePoint Designer x64 with SP1
  7. Visual Studio 2010 Ultimate with SP1
  8. Windows Identity Foundation SDK v. 4.0
  9. Visual Studio 2010 SharePoint Power Tools
  10. LINQ to SharePoint DSL Extension for VS2010
  11. SpDisposeCheck - VS Addin for validating Sharepoint 2007/2010 dispose objects
  12. FxCop-Code Quality scanning tool
  13. Microsoft Pex and Moles-tool for creating Mock libraries (similar to Moq, NMocks, RhinoMocks etc.)

Wednesday, August 17, 2011

Submitting suggestions for Microsoft Visual Studio

Microsoft recently modified their http://connect.microsoft.com website to provide a separate forum for making suggestions and providing feedback on feature sets for Visual Studio.

The new website is called Visual Studio UserVoice.  You can check it out here: http://visualstudio.uservoice.com/forums/121579-visual-studio

Friday, August 12, 2011

Sitefinity Template Builder

In order to assist Sitefinity developed in creating templates for Sitefinity v. 4.x and v. 5.x, you can now use the online template builder to create and later export these templates for use within Sitefinity v. 4.x and v. 5.x.

You can use the online Template Builder here: http://templatebuilder.sitefinity.com/

Here is some documentation on how to use Sitefinity templates created with Template Builder:

http://www.sitefinity.com/resources/template-builder.aspx

http://www.sitefinity.com/documentation/documentationarticles/template-buider/

http://www.sitefinity.com/documentation/documentationarticles/template-buider/6-import-the-template-in-sitefinity/

Thursday, August 11, 2011

SQL Server Developer Tools

SQL Server Developer Tools has been released as CTP3 for a while now, but if you have not tried them out yet, you should definitely give it a whirl. 

It brings a whole host of features to the Visual Studio development environment that provides an overall much better experience while working with SQL Server including features previously only available through SQL Server Management Studio as well as features uniquely suited to Visual Studio.

http://msdn.microsoft.com/en-us/data/tools.aspx

Wednesday, August 10, 2011

Sitefinity v. 4.2 Released Today

Sitefinity v. 4.2 was just released today.  It includes several performance improvements as well as integration of the Migration Module from Sitefinity v. 3.7 SP4. 

You can read the full release notes here:

http://www.sitefinity.com/versionnotes.aspx?id=2556

Saturday, August 6, 2011

Changing the database connection string in Sitefinity v. 4.x

In Sitefinity v. 4.x, the database connection string is no longer stored beneath the <connectionStrings> element in the Web.config file.  Instead, the connection string information is stored in a new configuration file called DataConfig.config.

Fortunately, with some minor changes you can also modify the connection string information to once again utilize it from the Web.config file.

You can find detailed instructions about the new database connection string format here:
http://www.sitefinity.com/devnet/forums/sitefinity-4-x/developing-with-sitefinity/web-config-transformations.aspx

Configuring IIS for Sitefinity v. 4.x

If you have not installed Sitefinity v. 4.x before, you may not know that there are some specific configuration IIS settings that need to be configured prior to deployment that differ from the original IIS configuration requirements in Sitefinity v. 3.7x.  If you do not configure them, you will experience numerous error messages preventing you from accessing and using Sitefinity.


  1. Make sure you configure the Sitefinity Web Site/Application to point to a .Net 4.0 Application Pool
  2. Make sure that you configure the Authentication settings for only a single authentication method.  The recommended authentication method is "Anonymous access".  If you have more than one authentication method configured in IIS, you will experience a pop-up dialog preventing you from accessing the Sitefinity administrative backend.

Wednesday, August 3, 2011

Cool features I like in Sitefinity v. 4.x

Sitefinity v. 4.x introduces a whole new host of features and I am just getting to learn about all of the new features that are either immediately apparent or others that are tucked away somewhat like "hidden gems".


  1. I  can finally create layouts for my pages without having to resort to creating Master Pages
  2. I can easily create expiration dates for publishing and unpublishing my pages
  3. I can now add a subset of the RadControls to my Sitefinity toolbox
  4. I can easily add JavaScript blocks to my Pages using the Script blocks
  5. I do not have to deal with the quirks of Classic vs. Overlay when dragging my toolbox items to my Pages as was present in Sitefinity v. 3.7x
  6. I can finally re-order images in my Image Gallery for display.

Getting to know ApplicationPoolIdentity

If you have not used Windows Server 2008 R2 much, you may not have noticed that there is a new account available for IIS called ApplicationPoolIdentity

If you have been working with IIS for any length of time, you are probably most familiar with the Network Service account.  Well, there were some limitations and issues that were encountered when multiple applications were utilizing the Network Service account, particularly 3rd party applications running in IIS such as Perl, PHP etc.  Therefore, the Microsoft team introduced the ApplicationPoolIdentity account to address these needs.

You can read more about the ApplicationPoolIdentity account here:

http://learn.iis.net/page.aspx/624/application-pool-identities/

http://blogs.iis.net/webdevelopertips/archive/2009/10/02/tip-98-did-you-know-the-default-application-pool-identity-in-iis-7-5-windows-7-changed-from-networkservice-to-apppoolidentity.aspx

http://learn.iis.net/page.aspx/202/application-pool-identity-as-anonymous-user/

http://forums.iis.net/t/1187121.aspx

Tuesday, August 2, 2011

Online tool to generate machine keys

If you need to generate a machineKey element for your ASP.Net application's web.config file, you can now use this online tool to easily generate this element:

http://aspnetresources.com/tools/machineKey

If you are using an ASP.Net-based CMS such as Sitefinity 4, you may encounter issues where you are constantly being logged out after performing some content management operations.  Adding this element to your web.config file can correct this frequent "log out" behavior.

Sunday, July 31, 2011

Google Public DNS

If you are having problems with DNS lookups and you are not sure if it is due to your ISP, the easiest way to solve this problem is to use Google Public DNS.

You can find instructions for setting up Google Public DNS here:

http://code.google.com/speed/public-dns/

Wednesday, July 27, 2011

New version of SQL Server Migration Assistant released

A new version of SQL Server Migration Assistant was just released which now supports a broader range of SQL Server platforms including the upcoming release of SQL Server "Denali"

http://blogs.msdn.com/b/ssma/archive/2011/07/12/announcing-sql-server-migration-assistant-ssma-v-5-1.aspx

On a more interesting note, SQL Server "Denali" introduces the concept of sequences which have been present in Oracle but compared to identity key values in SQL Server.  The major discrepancy in the past between the 2 platforms differed in the way that the values were stored.  Whereas Oracle stored the sequence information independent of the table, SQL Server always stored this information directly with the table information.  With the new introduction of SQL Server sequences in "Denali", it will be interesting to see how future Oracle migrations to SQL Server "Denali" occur.

http://blogs.msdn.com/b/ssma/archive/2011/07/12/converting-oracle-sequence-using-ssma-for-oracle-v5-1.aspx

Using Web.config transformations in Sitefinity v. 4.x

In Sitefinity v. 4.x, the connectionStrings element has been moved from the Web.config file to a file called DataConfig.config.  Unfortunately, the move away from the Web.config file does not allow one to leverage Web.config transformations which were introduced as part of Visual Studio 2010.

Fortunately, the folks at Telerik are able to offer a solution that will allow developers to continue to utilize Web.config transformations:

http://www.sitefinity.com/devnet/forums/sitefinity-4-x/developing-with-sitefinity/web-config-transformations.aspx

Tuesday, July 26, 2011

Visual Studio LightSwitch 2011 Released!

Visual Studio 2010 LightSwitch 2011 is now available for download for all MSDN Subscribers:

http://msdn.microsoft.com/en-us/subscriptions/default.aspx

You can read more about LightSwitch here:

http://www.microsoft.com/visualstudio/en-us/lightswitch

Optimizing Performance in Sitefinity v. 4.x

If you are experiencing performance problems and issues with Sitefinity v. 4.x, here are some tips that you may want to try to improve the overall performance and response time of Sitefinity v. 4.x:

http://www.sitefinity.com/documentation/installation-and-administration-guide/tips-for-optimizing-performance.aspx

Uploading User Controls for Sitefinity 4.x

If you previously used Sitefinity v. 3.7, you may notice that the method of uploading User Controls has changed significantly in Sitefinity v. 4.x.

The documentation that outlines the process and steps to upload a User Control in Sitefinity v. 4.x can be found here:

http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-controls-adding-controls-to-the-toolbox.html

Monday, July 25, 2011

Using Outlook to read Lotus Notes e-mail messages

If you are a current user of Lotus Notes, but a former user of Outlook, like most individuals, you probably prefer to use Outlook for checking and reading your e-mail messages rather than Lotus Notes.

Fortunately, IBM has released a connector to allow you to do just that! 
It is called the Domino Access for Outlook Connector.

Instructions on how to configure the Domino Access for Outlook connector can be found here:
http://www.sharepoint2007security.com/blog/2009-10-09/using-office-outlook-2010-lotus-notes-backend-connector-damo-windows-7
http://www.slipstick.com/addins/services/connecting-outlook-to-lotus-notes/

If you are looking to download the DAMO connector, you can visit the IBM website to download it.  The most current release of the DAMO connector is Fix 6 and should have a file name of setup.DAMO.InterimFix6.2010.exe.


How can customers get access to the latest Domino Access for Microsoft Outlook (DAMO) release?

https://www-304.ibm.com/support/docview.wss?uid=swg21321549

Saturday, July 23, 2011

Deploying Sitefinity v. 4.x to a shared hosting provider

Unfortunately, due to the nature of deploying to a shared hosting provider, you have to alter the schema associated with the database in order to get Sitefinity to work.  For example, if you are developing on your local machine using 'sa' or similar 'dbo' privileges, when you finally deploy a backup of your development database to your shared hosting provider, you will have to create an associated username/password that will be associated with that particular database.

In those instances, since the 'dbo' schema will no longer be accessible, you will have to alter the name prefix of the database schema from 'dbo' to the user name you created in your shared hosting provider configuration.

Details about how to accomplish this can be found here:
http://www.sitefinity.com/devnet/forums/sitefinity-4-x/bugs-issues/error-invalid-root-node-configured-for-pages-no-root-node-with-the-name-of-quot-frontendsitemap-quot.aspx


In addition, some shared hosting providers provide support for Full Trust, but the hosting providers by default run in "Medium Trust".  Therefore, it is necessary to add the <trust level="Full" /> element to the Web.config file in order to get the ASP.Net Web Site to run under Full Trust (as is required by Sitefinity v. 4.x)

The database script to rename the associated database schema can be found below:


DECLARE tabcurs CURSOR
FOR
SELECT 'dbo.' + [name]
FROM sysobjects
WHERE xtype = 'u'

OPEN tabcurs
DECLARE @tname NVARCHAR(517)
FETCH NEXT FROM tabcurs INTO @tname

WHILE @@fetch_status = 0
BEGIN

EXEC sp_changeobjectowner @tname, 'charity'

FETCH NEXT FROM tabcurs INTO @tname
END
CLOSE tabcurs
DEALLOCATE tabcurs

NOTE: You should run this script to change the database owner prior to actually accessing the website for the first time in Sitefinity. If you access the website through Sitefinity first, Sitefinity will attempt to create the necessary database objects for you, thus resulting in potentially duplicate table creation.

Designing a Theme in Sitefinity v. 4.0

As of Sitefinity v. 4.0, the usage of the App_Themes directory has been modified from Sitefinity v. 3.7.  The App_Themes directory is now located inside the App_Data directory.

To learn how to create a Theme in Sitefinity v. 4.0 and above, you can review the documentation here:
http://www.sitefinity.com/documentation/designers-guide/creating-a-theme/registering-a-theme.aspx

Developing Skins for Telerik Sitefinity

If you need to build skins for the Telerik RadControls included within Sitefinity, you should use the Telerik Visual Style Builder to easily modify existing styles or create a brand new style.

You can access the Telerik Visual Style Builder here:

http://stylebuilder.telerik.com/

Thursday, July 21, 2011

Save and Publish in SharePoint Designer

I just recently learned that Save and Publish in SharePoint Designer actually function independently.

Whereas in Visual Studio, when I perform a Publish operation, Visual Studio automatically saves my current changes, performs a build/compile and then proceeds with the publish operation, SharePoint Designer does not appear to do the same thing.

Instead, it seems that the Publish operation in SharePoint Designer simply publishes the last saved copy of the workflow rather than saving the current content in the workflow designer prior to publishing the workflow.

Therefore, in order to ensure that the latest changes you have made in workflow designer are committed, you will have to perform the Save operation prior to performing the Publish operation.

Creating a Url hyperlink in SharePoint Designer

Unfortunately, as you may already know, SharePoint Designer 2010 does not offer a great way to obtain the Url  and hyperlink to an item such as a List within SharePoint.  Of course, this makes it very difficult when you are composing e-mail messages within SharePoint Designer to send as part of a custom workflow.

Even though the solution is definitely less than ideal, the solution I discovered was this:


  1. Use the Extract Substring from Start of String action to extract the base Url from the Encoded Absolute Url
  2. Use a Workflow variable and the dynamic string builder to concatenate this value with the Current Item:Path for the list
  3. The resultant Url stored in the workflow variable should be the correct Url to the List

Tuesday, July 19, 2011

Resolving Moles Assembly Reference issues

If you are experiencing issues with Moles Assembly Reference issues when loading a Visual Studio 2010 project, you will probably have to go through the following steps in order to have Visual Studio fix up the assembly references for you so that you can actually successfully compile your project:


  1. Right click on the solution and select the menu option for "Upgrade .Moles files"  
  2. You will then get a dialog prompt asking whether or not you want to update all the .moles files in your projects.  
  3. Click on the OK button to proceed with the upgrade.
  4. Re-build the solution.
  5. If everything went well, the solution should now successfully build.
  6. If things did not go so well, you can try the solution posted here: http://samirvaidya.blogspot.com/2011/02/failed-to-generate-strong-name-key-pair.html


Monday, July 18, 2011

Troubleshooting SharePoint 2010 Error Messages

If you encounter any SharePoint error messages, odds are you will see some type of Correlation ID associated with the error message on the screen.

Fortunately, if you have that error message, you should be able to further investigate the issue through examining the SharePoint logs, or else simply convey this information to your SharePoint Administrators and they should be able to pinpoint the issue for you.

The details on how to utilize the Correlation ID to troubleshoot SharePoint error messages can be found here:
http://sharepoint.microsoft.com/Blogs/GetThePoint/Lists/Posts/Post.aspx?ID=353

Wednesday, July 13, 2011

Easy ways to create Virtual Machines for VMWare

One of my colleagues just came across this site which allows you to easily create configurations for VMWare virtual machines:

http://easyvmx.com/

SQL Server 2008 R2 SP1 released

For anyone currently using SQL Server 2008 R2, Microsoft recently released SP1.  The latest service pack can be downloaded here:

http://www.microsoft.com/download/en/details.aspx?id=26727

SQL Server 2012 RTM Released

SQL Server 2012 was recently released.  There are many new features in SQL Server 2012, but one particularly interesting feature is a new feature called LocalDB which sounds a lot like SQL Server Compact Edition.  Based on what I have read so far, it sounds like how I wished SQL Server Express Edition worked with the App_Data folder in ASP.Net.

You can download the latest Trial/Evaluation version here:

http://www.microsoft.com/download/en/details.aspx?id=29066

You can download the Express Edition here:

http://www.microsoft.com/betaexperience/pd/SQLEXPCTAV2/enus/default.aspx

Precompilation for Web Application Projects

If you wish to utilize precompilation for Web Application projects just as you were able to do using precompilation for Web Site projects, fortunately, you can do this through a Web Deployment project.

You can download and install the Web Deployment Project installer for Visual Studio 2010 from here:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=24509

You can then follow the same steps in Visual Studio 2010 as the steps described for Visual Studio 2008:
http://amiraryani.wordpress.com/2008/10/13/pre-compile-web-application-by-vs-2008/

Below is a screenshot of the dialog from the Property Pages of the Web Deployment project here:

Sunday, July 10, 2011

Converting a Web Site project to a Web Application project

I recently had to convert a Web Site project to a Web Application project and unfortunately, the entire process is largely manual even while using the latest release of Visual Studio--Visual Studio 2010 SP1.  There is an MSDN article which describes this process (http://msdn.microsoft.com/en-us/library/aa983476.aspx), but I have found numerous things missing from the documentation, therefore, I am outlining the steps I followed here:

  1. You will have to first create a blank or empty Web Application project for the target .Net Framework (such as .Net 3.5 or .Net 4.0 etc.)
  2. You can then add all of your existing items from your Web Site project to the newly created Web Application project
  3. If you have an App_Code folder in your current Web Site project, you will need to rename the folder to something such as CodeFolder or ClassFiles etc. due to this problem with the App_Code folder in Web Application projects as described here: http://vishaljoshi.blogspot.com/2009/07/appcode-folder-doesnt-work-with-web.html
  4. For any folders that have content contained within them, if there are any .aspx.cs or .cs files that will need to be included as part of the compilation, you should highlight all of the items and open the Properties menu.  For the Build Action property, set the Build Action to Compile.  For any .aspx or .ascx files, ensure that these files still have the default Build Action set to Content.
  5. If you have any missing project references, you will have to add the appropriate references through the Add Reference Dialog.
  6. There may be several instances where the original .aspx or .ascx files cause compilation errors that were completely missed/unnoticed in Web Site projects.  In those instances, you will have to manually correct those errors.
  7. Unfortunately, you may have to correct each error on a file-by-file basis while building/re-building between each change since Visual Studio will usually not be able to display all of the errors in the Web Application project simultaneously. 
  8. Since the creation of the designer files associates the partial classes with a namespace, you will have to use the "Surround With" option to surround all of your code behind partial classes with a namespace.
  9. Unfortunately, doing this also requires you to update all of your Page Directives for the Inherits attributes to match the corresponding namespace and class name for each and every one of your pages/controls as well.  If you are using a tool such as Resharper, Resharper should provide you with Intellisense to autocorrect the fully qualified name to include the namespace in the Page Directive.
  10. If you have an existing Global.asax file, you will need to copy the appropriate code from it and delete the existing Global.asax file.  You can then re-create it by adding a new Global Application Class.  This is required because there is no option to "Convert to Web Application" for a Global.asax file.
  11. For any .aspx or .ascx files you have in the project, highlight all of the items and select "Convert to Web Application".  This will generate the appropriate designer files for you.
  12. Re-build the project until all errors have disappeared.  If no errors display, you have successfully converted a Web Site project to a Web Application project!  Whew....

Wednesday, June 29, 2011

Tuesday, June 21, 2011

ASP.Net Universal Providers

In an effort to unify the various Providers in the ASP.Net framework such as the ASP.Net Membership Provider, Role Provider, Profile provider etc. the Microsoft team has released an Alpha release of the ASP.Net Universal Providers.  One of the major benefits of having a "universal provider" is that the same code base can be used to access SQL Server, SQL Server Compact Edition as well as SQL Azure simply by changing the underlying database connection string!

You can read more about the new ASP.Net Universal Providers here: http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx

If they can implement such a thing so as to encapsulate other major database providers such as Oracle and MySQL, it will make code maintenance across different database platforms a snap!  I guess all we can do is cross our fingers and wait....

Saturday, June 11, 2011

Fixing the IE Download Limit

If you have been frustrated with the IE Download Limit configured in nearly version of Internet Explorer,  fortunately, Microsoft has finally offered an easy fix to increase the limit.

In the past, you would have had to manually modify some registry key entries or run a script which would perform the registry entry modifications for you.  But now, you can simply run an executable which will make the modifications for you and it is all described in a Microsoft Support Knowledgebase article:

How do I configure Internet Explorer to download more than two files at one time?
http://support.microsoft.com/kb/282402

Thursday, June 9, 2011

Setting the Name attribute in HtmlInputHidden fields

I was recently creating a Web Form that was using a Submit button with the PostBackUrl attribute configured to a 3rd party payment gateway (in this case, I was using Authorize.Net).

As you may or may not know, when you configure the PostBackUrl to an external website such as a 3rd party payment gateway, there is really no opportunity to perform any server side processing prior to submitting the form.

Fortunately, I found a reference to this article in the ASP.Net Forums which provides a workaround specifically for such a scenario: http://www.jigar.net/articles/viewhtmlcontent78.aspx

So after compiling a class to handle the RemotePost, I wanted to add my necessary hidden fields for submission to the Payment Gateway.

I first tried simply adding the Html Input Hidden Fields that were already present in the form.  Unfortunately, this did not work at all since the names for the hidden fields are altered by ASP.Net into a convoluted string which seems to indicate the hierarchy of the control in relation to other controls on the form.

Given this, it immediately became obvious that I would have to parse out the actual names and then assign the correct names.

Unfortunately, simply by using the following code:


HtmlInputHidden authNetHdnControl = new HtmlInputHidden();
                    authNetHdnControl.Name = strHdnControlName;
                    authNetHdnControl.Value = hdnControl.Value;

I could not get the code to work!  Each time I attempted to set the Name attribute on the HtmlInputHidden control, the Name would come back as null (even though the attribute provides a getter and setter).

Based on a hunch, I simply set the ID for the control instead, rather than attempting to set the Name attribute explicitly:



HtmlInputHidden authNetHdnControl = new HtmlInputHidden();
                    authNetHdnControl.ID = strHdnControlName;
                    authNetHdnControl.Value = hdnControl.Value;

Voila!  Everything worked properly and the Name attribute was being set based on the value I set for the ID attribute.

So, if you run into this problem yourself, just remember to set the ID attribute just like you would for a standard ASP.Net Server Control (even though the control is an Html Server Control)!




Monday, June 6, 2011

My SharePoint Designer Wish List

If you have worked with SharePoint Designer for any length of time, there are probably numerous features you wish you had, but don't.  As Microsoft would state: "Use Visual Studio instead!"  Well, in many scenarios, using Visual Studio simply is not an option because the environment dictates that workflow development cannot be published using Visual Studio.  Therefore, I am forced to use SharePoint Designer. 

Given this forced restriction, below is a brief list of features and capabilities that I wish I could use in SharePoint Designer:
  1. Be able to copy and paste from any dialog regardless of whether it is a String Builder Dialog or an E-mail message dialog
  2. Be able to drag and drop actions from one step to any other step
  3. Be able to copy and paste existing actions within a workflow
  4. Be able to use Encoded Absolute Url for Lists other than Document Libraries
  5. Be able to move actions in and out of if/else blocks
  6. Be able to right click on any action and convert it to a snippet
  7. Be able to move back and forth between design view and code view similar to designing and developing with ASP.Net Web Forms
  8. Provide a design surface similar to Visual Studio with drag and drop capabilities of any action, condition, step etc.
  9. Be able to design a "SharePoint Designer-compatible worklow" in Visual Studio and import it into SharePoint Designer
  10. Be able to put break points, debug assertions or traces in a workflow
  11. Be able to step into and out of workflows by attaching to a SharePoint process
  12. Be able to output Debug or Logging messages to a log file or to a Web Part, MessageBox window etc.
  13. Be able to re-use content types across several Collect Data steps
  14. After deleting a conditional statement, be able to move the statements nested within the conditional statement elsewhere.
  15. After adding a lookup for a user, be able to view and edit the details for the user lookup.

Friday, June 3, 2011

Allowing drive redirection in Windows Remote Desktop

If you have ever wanted to map a drive letter over a Remote Desktop session and have discovered that simply changing the drive redirection in the Remote Desktop client is insufficient, you may have to modify these settings at the server level.


  1. At the Run prompt, type gpedit.msc
  2. Expand the node for Computer Configuration
  3. Expand the node for Administrative Templates
  4. Expand the node for Windows Components
  5. Scroll down until you find the node for Terminal Services
  6. Beneath this node, you should find a node for Terminal Server-->Device and Resource Redirection
  7. After clicking on this node, you should find a set of group policies
  8. Amongst these group policies, look for the policy that states "Do not allow drive redirection"
  9. Open the policy by double clicking on it
  10. Select the radio button for Disabled and click the OK button
  11. Re-connect via the Remote Desktop client
  12. You should now see your local workstation drive letter mapped on the server!

Thursday, June 2, 2011

Jetbrains TeamCity 6.5 released!

Jetbrains (the company that makes Resharper) just recently released TeamCity 6.5.  Many of the limitations that have been present with earlier releases of TeamCity have now been removed with the exception on the limitation of total build configurations (it is still 20).

You can read about the new features in this release here:

http://www.jetbrains.com/teamcity/whatsnew/index.html

If you are upgrading from a prior release of TeamCity, details on how to perform the upgrade can be found here:

http://confluence.jetbrains.net/display/TCD65/Upgrade

http://confluence.jetbrains.net/display/TCD65/TeamCity+Maintenance+Mode

Monday, May 30, 2011

CSS Rendering with IE 8 and IE 9

Well, despite all of the statements regarding the greater CSS rendering compatibility of Internet Explorer 8, I have found that to be not true.  Though the CSS rendering between IE 8 and other alternative browsers such as Mozilla Firefox and Google Chrome is not nearly as significant as it was in the past, it nevertheless differs.  I imagine this was because IE 8 had to support IE 7 backwards compatibility, thereby contributing to its continued CSS rendering flaws whereas IE 9 only supports IE 8 backwards compatibility. 

CSS styles which make heavy use of margins and padding are simply not treated the same as they are in these other browsers.  Therefore, to accommodate IE 8, you will nevertheless have to manage your CSS stylesheets based on which browser you are supporting.

However, on the bright side, IE 9 seems to provide a nearly comparable experience against alternative browsers.  When compared side by side against Mozilla Firefox 4.01, Google Chrome 11.0 and Opera 11.10, the CSS rendering of IE 9 only differed very slightly.  The overall layout and appearance remained roughly the same.

Unfortunately, since IE 9 was just recently released, you will not find the same widespread usage as with IE 8 which came shipped with Windows 7. 

So it looks like, at least for the time being, you will have to continue to modify your CSS stylesheets to accommodate the various browser platforms and add special handling for IE 8.  Never fear, though, there will eventually come a day when IE 9 will become the primary IE browser on the market and many of your CSS rending compatibility hassles will go away...