ASP.net

36 posts

How to fix the Login failed for user ‘IIS APPPOOLASP.NET v4.0’ error in IIS7 and Sql Server 2008

The Problem: You are trying to access a sql server database from your new ASP.net 4.0 site and get the error Login failed for user ‘IIS APPPOOLASP.NET v4.0’ error in IIS7 and Sql Server 2008 when logging in with the integrated security. The Cause: The new default user for asp.net 4.0 does not have default […]

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 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 […]

CSS trick – how to use two classes on a single DOM object

I have no idea how this trick has eluded me for so long, but it is possible to use two classes on the same DOM object.  For example to combine a class called “TopNav” and a class called “SelectedNav” all you have to do is call them both with code like this <div id=”HomeNavItem” class=”TopNav […]

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 […]

How to Fix: Canonical Urls with IIS 7’s Url Rewrite feature for https

The Problem: You want to make your website all SEO friendly by creating a single, canonical url.  For example, if someone types in https://www.stronico.com, you want them to be redirected to https://stronico.com (Google likes it this way).  You do some research and discover that all of the default code and documentation for handling canonical Urls […]

How to fix updating problems in your Silverlight application

The Problem: You make changes to your Silverlight Application, but you do not see it reflected when you debug or run the solution. The Cause: While the web project portion of the solution is being compiled and run, the Silverlight project is not being built.  This just happened to me recently.  Visual Studio crashed and […]

How to fix strange errors in silverlight web services

The Problem: You upload your wonderful Silverlight application to a new server and begin to get all sorts of strange errors, most notably something like this Message: Unhandled Error in Silverlight 2 Application An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.   at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at StronicoMain.ServerUtil.AddressTypeListCompletedEventArgs.get_Result() at StronicoMain.Page.proxy_AddressTypeListCompleted(Object sender, […]