Thursday, September 30, 2010

Using jQuery with Sitecore and avoiding conflicts with Prototype

When using jQuery with Sitecore you need to take additional steps so that the jQuery $ function doesn't interfere with the Prototype $ function that Sitecore uses for the Sitecore Ribbon.

Example from

(function($) { 
  $(function() {
    // more code using $ as alias to jQuery
// other code using $ as an alias to the other library

See Also:

Friday, September 24, 2010

System.Web.MembershipProvider and RoleProvider references not found in unit tests after VS2010 upgrade

After updating a solution from VS2008 to VS2010 the unit tests for our custom web security providers started failing the builds with messages like:

Error    15    The type or namespace name 'MembershipProvider' could not be found (are you missing a using 
directive or an assembly reference?)    D:\Development\[snip].UnitTests\ProviderHelper.cs
Error    16    The type or namespace name 'RoleProvider' could not be found (are you missing a using 
directive or an assembly reference?)    D:\Development\[snip].UnitTests\ProviderHelper.cs
Error    4    The type name 'RoleProvider' could not be found. This type has been forwarded to assembly 
'System.Web.ApplicationServices, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 
Consider adding a reference to that assembly.    D:\Development\[snip].UnitTests\ProviderHelper.cs

The last exception here reveals the issue. The project now needs a reference to System.Web.ApplicationServices

Saturday, September 18, 2010

Writing cleaner WebControl HtmlTextWriter output with a fluent interface

Producing HTML output from a ASP.NET WebControl is fairly verbose in terms of the amount of markup required. This isn't ideal for readability or maintenance.

When I find a workable solution I'll post it here. Right now I'm thinking it will be some form of Fluent interface.

See Also:

Wednesday, September 15, 2010

IE8 Trusted sites not displaying PDFs in a popup window with Adobe Reader 9

First, some background on the development environment:

  • Windows Server 2008 - 64 bit
  • Internet Explorer 8.0.6001.18943 (using the 32 bit exe)
  • The website is running under SSL
  • The site has been added to the Trusted sites security zone with Protected Mode off
  • The functionality works fine in Firefox and Chrome.
  • Adobe Reader 9.3.4
  • Internet Explorer add-on: Adobe PDF Link Helper

Steps to reproduce:

  • Login to the SSL site
  • Click on the javascript link that opens a new window with the URL to return the PDF.
  • The popup window opens (in my case as a tab) and is marked as being in the trusted sites zone.
  • The page appears to be completely blank with no content or HTML loaded.


It appears the issue could be related to IE8 opening the new tab in a separate process and not correctly passing the session cookies in with the new request. See Stack Overflow IE8 losing session cookies in pop-up windows.

Happened again

This definitely appears to be related to the site being in the trusted zone. In another similar case a pop up window would spawn in a new window without the session cookies when triggered from a trusted zone. When the site was taken out of the trusted zone the pop up would open in a new tab with the session cookies.

Trusted Zones and iframes

Update 23/01/2012 - Encountered another variant of this issue when the website trying to open the popup window was in the trusted security zone and an iframe of a parent site. The parent website that contained the iframe wasn't in the trusted website zone and IE was showing mixed zone security messages. When the popup window appeared it was in the trusted zone but had lost the session cookies.

Friday, September 10, 2010

The referenced assembly "log4net" could not be resolved because it has a dependency on System.Web

Here is a riddle, what is wrong with this brand new .NET 4.0 console application that only references the log4net dll?

error CS0246: The type or namespace name 'log4net' could not be found (are you missing a using directive or an assembly reference?)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3253: The referenced assembly "log4net" could not be resolved because it has a dependency on "System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.


The projects target framework is set to the client profile version of the .NET framework, which excludes (typically) server side assemblies such as System.Web.

Changing the Target framework under the Application project properties resolves the issue.

See Also:

Thursday, September 2, 2010

Getting the latest version of the Adobe Flash Player when the Download Center fails


  • (IE)
  • (Firefox

Notes from Tech.Ed 2010 Presentations

Wednesday, September 1, 2010

DEV203 Implementing TFS 2010 – A Real World Perspective

Speaker(s): Gavin Lees

Tech.Ed Online

- Process Management
- Version Control
- Work Item Tracking
- Build Automation
- Reporting

Tight VS2010 integration

Advanced source Controls
- Branching/merging
- Changesets
- Shelving
- Check-in policies (add comment, work item association)

Automated builds
Lab manager
SharePoint integration
VS2010 Ultimate freatures

Team Project Collections:
- independent storage in separate SQL databases
- Logical organisation units
- improve scalability
- Can grant security access to just the collection
- Cannot link work items across collections
- cannot branch or merge code across collections
- cannot create queries across collections

Created via Team Foundation Server Administration Console.

Modifying Process Templates
- Install TFS power tools for editing templates
- Edit process templates locally.
- Accessed (Upload/Download) from the top level of team explorer. (Process Template Manager)
- ProcessTemplate.xml
- Global Lists - uploaded to TFS via the command line
- Edit .wit files but upload .xml files back to TFS.

witadmin - command line tool for working with work items. Includes functionality that isn't supported by TFS.

Reverting a changeset
- Get by changeset gets all previous changes.

Run command prompt from directory
> tfpt getcs /changeset:14


Application Tier configuration for email alerts.

DEV301 A Whirlwind Tour of the Microsoft .NET Framework 4.0

Speaker(s): Owen Evans

Tech.Ed Online

- Client Templating

Web Forms
- ClientIDMode & ClientIDRowSuffix - ClientIds less nested
- Routing - Now part of the core framework - 
 clrver -all

Visual Studio 2010 Training Kit

WEB311 The Scaling IQ Test: When Development and IT Pros Collide

Speaker(s): Richard Campbell

Tech.Ed Online

The IT/Dev Meeting
Need senior staff from both IT and dev to make app related decisions.

Email < IM < Phone < Meeting < Lunch/Food

- Accuracy (Generally first)
- Reliability (Generally second)
- Performance
- Scalability
Put them in order, every site has different priorities

Give the CTO an account call "Administrator" that is actually a guest user.

- None
- Windows (Active Directory, Basic)
- Forms Based

- Connection strings
- Ensure they are used or remove them.


- In-process vs. out-of-process
- load balancing

Load Balancing
- How to make SQL server fail over cleanly.

Performance Bottlenecks
- Scheduled tasks
- Key points that could take the application down.

Things Dev Need to Know

Network Diagram
Production Logs
- Truth about what is happening with the application
- Analysis to create test data (web trends). What are the users actually doing.
Disaster Recovery
- coding support requirements. How much data can be lost?

After the IT/DEV meeting
- Get business buy in

- Meet with IT/Dev early
- repeat

DEV306 Taming SOA Deployments using Windows Server AppFabric

Speaker(s): Peter Goodman, Stefan Sewell

Tech.Ed Online

SOA Challenges
- Monitoring

- Service hosting and Scale-out

- Deployment
  co-ordinate across multiple hosts and technologies
  support repairing, patching, updating, removing

Windows Server AppFabric ("Dublin")
- WCF & WF Service Monitoring
- Workflow Service Hosting and Scale-out
- PowerShell API and IIS Manager Extensions
- Distributed Cache ("Velocity")

- Centralised monitoring store in SQL Server
- Configurable with support for custom events.
- Not suitable for auditing as messages may be dropped under high load.

AppFabric Event Collection Service -> AppFabric Monitoring. Data passes through staging table.
Config screen for WCF Message logging.

Workflow Service Hosting and scale-out
- workflows can be restored to any server provided they have the definition.
- InstanceLock to control access to Workflows (timeout and polling for crashed workflows)
- Out of the box support for persisting to SQL Server 2008.

Automating deployments using PowerShell
- PowerShell v2
  Remote shells and remote command invocation
  In Win 7 and Server 2008
  Fully interoperable with .NET and COM components
  Call from managed code via System.Management.Automation
  Uses verb-noun pairs.

PS C:\> import-module Webadministration

Windows PowerShell ISE - Development environment

Declarative deployment
- Environment Definition
  - List of servers
  - Mapping of roles to servers
- Role Definition
- Deployment Engine

DEV401 LINQ Confidential: A Deep Dive Into How LINQ Works

Speaker(s): Ivan Towlson

Consumers versus interface implementers

- Extension methods
- Lambda expressions
- var - let the compiler figure out the type (type inference)

How the compiler compiles LINQ queries.

- Translation by compiler is naive/straight forward.
- Allows normal method resolution after first pass translation.
- Would pull all data from datasource and then filter

LINQ is very sensitive to the compile time type as to which methods get resolved to.

- Returns sequence in the same way as IEnumerable but defers to IQueryProvider that runs the actual query.

Lambda is not exactly the same as a delegate. Could be determined as an expression depending on the target(how they are used). Prefers Expressions over delegates when possible.

Lambda expression can't compile to var as it must explicitly go to Func or Expression.

Turing an expression tree into an acutal query.