Archive by Author

ASP.NET 4.0 Custom Error Pages Very Slow to Load

When I upgraded to ASP.NET 4.0, runtime errors suddenly became very slow. There was a consistent two-minute delay before my custom error page would appear. The rest of the website was lightning fast, so it was not related to compilation. I finally decided to tackle this problem, so I started copying blocks of code into a new, blank custom error page. The delay was not present until I […]

SQL Server Unique Index with Multiple NULL Values

Sometimes I require unique values in a column that allows nulls. CREATE UNIQUE NONCLUSTERED INDEX IndexName ON dbo.TableName(ColumnName) WHERE ColumnName IS NOT NULL Update: SQL Server Management Studio has this functionality built into the Index Properties dialog. ([ColumnName] IS NOT NULL)

Remote Desktop Services Multiple Sessions

As far as I can tell, it is trivial to enable multiple simultaneous remote desktop sessions for Windows Server 2008. Open gpedit.msc Navigate to Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Connections Double-click “Restrict Remote Desktop Services users to a single Remote Desktop Services […]

Entity Framework Count Child Entities

Expanding on the post “Entity Framework Filter Child Entity“, I finally figured out how to get a GridView to show the count of child records. Unfortunately I am returning the whole set of entities and doing a Count on them. It’s not a problem in this case. I’m just happy it works. Dim query = […]

Grant Alter Trace Permission SQL Server Profiler

SQL Server Profiler requires you to have ALTER TRACE permission. There are two ways to grant that permission. Properties: Object Explorer -> Security -> Logins -> your_login -> Securables -> Search button -> “The server” radio button -> “Grant” checkbox on “Alter Trace” SQL: GRANT ALTER TRACE TO myuser

How to Hash Passwords for XML Files

To save a password hash to an XML file, you can call this function: FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text & "|" & txtUsername.Text, "SHA1") You can see my attempt at a password salt by simply apppending the Username.