How To Fix

120 posts

How to fix being blocked by your web host

The Problem: For no known reason I became unable to reach my web host.  All of my websites and even the host’s public site vanished.  I could reach everything through remote desktop connections, but not from my home connection.  I had just backed up two gigs of files from one of my servers and I […]

How to Fix “Cannot Publish Because a Project Failed to Build” error

The Problem: You attempt to publish your C# ClickOnce application in Visual Studio 2010, but you get the “How to Fix “Cannot Publish Because a Project Failed to Build” error” error. There are no syntax errors. The Cause: No idea The Solution: Simply right click on the solution in the Solution Explorer, and click “Publish” […]

How to fix the Asp.net CalendarExtender and CompareValidator to accept European date formats

The Problem: You want to use the standard European Date Format, DD/MM/YYYY instead of the American Date Format MM/DD/YYYY.  You change the “Format” feature of the CalendarExtender to “DD/MM/YYYY”, but then the CompareValidator (which you’re using to ensure valid dates) calls out that you have entered an invalid date. The Cause: The Compare Validator is […]

How to fix the “could not load file or assembly microsoft.sqlserver.batchparser” error

The Problem: Every time you attempt to run Microsoft’s excellent Database Publishing Wizard Utility you get the following error after you enter your login information could not load file or assembly microsoft.sqlserver.batchparser The Cause: This problem can be taken literally – Microsoft.SqlServer.Batchparser is not installed on your computer. The Solution: Go To this link on […]

How to fix problems with the placeholder control and custom web user controls

The Problem: You are using an asp.net PlaceHolder control and populating it with a collection of custom web controls.  You then get “Null Reference Exception” and “Are you missing an assembly?” errors.  Your code looks much like this foreach (string str in strStringList) { CustomWebBox cb=new CustomWebBox()[ cb.CustomTitle=str; myPlaceHolder.Controls.Add(cb); } The Cause: The same ID’s are […]

How To Fix Column Doubling in an ASP.net GridView – with Code Sample

The Problem: You are trying to create an ASP.net GridView that automatically populates on any dataset, as well as automatically sorts, but for some reason whenever you click the headers to sort the GridView, the data doubles. The Cause: I originally omitted crucial line gv.Columns.Clear(); in the code sample below.    For whatever reason I […]

Silverlight Tip – How to make bold text in a textblock from the CodeBehind

The Problem: You need to conditionally bold text in a text block, but you cannot find any way of doing so The Cause: For inexplicable reasons, Microsoft chose not to include a FontWeight.Bold in their xaml specification The Solution: Microsoft did include a FontWeights (note the S) class  To bold text in the codebehind, all […]

How to fix a missing reference to mscorlib in Visual Studio 2010

I was trying to update my main app code to utilize the .Net Framework 4.0 and this happened: The Problem: I could find no obvious way to update the mscorlib reference in my solution, so I decide to simply delete it and add it again, and hope that it magically updates to the most recent […]

A simple way to create a Microsoft Word document from a template in Asp.net/C#

I recently had the need to create a Microsoft Word document from a template. I initially tried using Office Web Components and Interop but all that really wasn’t worth the trouble.  I wound up doing global replacements in the html of html   Here is how I did it: Open up your template document in […]

How to fix the “The service cannot be activated because it requires ASP.NET compatibility” error

The Problem: You try to access your web service on IIS 7 and you get the following error The service cannot be activated because it requires ASP.NET compatibility. ASP.NET compatibility is not enabled for this application. Either enable ASP.NET compatibility in web.config or set the AspNetCompatibilityRequirementsAttribute.AspNetCompatibilityRequirementsMode property to a value other than Required. at System.ServiceModel.Activation.HostedAspNetEnvironment.ValidateCompatibilityRequirements(AspNetCompatibilityRequirementsMode […]