‘How To Fix’ Archive

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

Read more on Silverlight Tip – How to make bold text in a textblock from the CodeBehind…

Popularity: 1% [?]

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

Runtime compiling is greatI 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 version.  This is actually what usually happens with Visual Studio.  However, I delete the mscorlib reference, and I am unable to add it back again, I get the error message telling me that mscorlib is already included in the project.

Read more on How to fix a missing reference to mscorlib in Visual Studio 2010…

Popularity: 1% [?]

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

Will code for food 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:

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

Popularity: 2% [?]

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 compatibilityMode) at System.ServiceModel.Activation.AspNetCompatibilityRequirementsAttribute.System.ServiceModel.Description.IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase) at System.ServiceModel.Description.DispatcherBuilder.ValidateDescription(ServiceDescription description, ServiceHostBase serviceHost) at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) at System.ServiceModel.ServiceHostBase.InitializeRuntime() at System.ServiceModel.ServiceHostBase.OnBeginOpen() at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open() at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)

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

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

Popularity: 3% [?]

How to fix the “550 Requested action not taken: mailbox unavailable or not local” email problem

Lost: Remote ControlThe Problem: You send an email to someone and get the following back

Your message did not reach some or all of the intended recipients.

Subject:    Any Subject

Sent: 6/4/2010 2:31 PM

Read more on How to fix the “550 Requested action not taken: mailbox unavailable or not local” email problem…

Popularity: 4% [?]

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

SATOR Magic squareThe Problem: You want to make your website all SEO friendly by creating a single, canonical url.  For example, if someone types in http://www.stronico.com, you want them to be redirected to http://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 in IIS 7 uses web.config files and the URL Rewrite application program.  All is well and good so far, but what if you use SSL?  The stock code will always redirect you to http://stronico.com/Signup/ even if the original url was https://stronico.com/Signup/ (note the https). Read more on How to Fix: Canonical Urls with IIS 7’s Url Rewrite feature for https…

Popularity: 4% [?]

How to fix the 550 #5.1.0 Address rejected email problem

email_subscribeThe Problem: All email that you send get’s bounced back with the following message:

Subject Line: Delivery Status Notification (Failure)
Message: Delivery to the following recipient failed permanently:
user@domain.com
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 #5.1.0 Address rejected user@domain.com (state 14).

The Cause: There is no “mail.domain.com” in the dns system.  In my case I was sending the mail via an alias (it was a notification email from the web server).  The receiving mail server sees the email as forged and bounces it.

Read more on How to fix the 550 #5.1.0 Address rejected email problem…

Popularity: 100% [?]

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.2cv_phil_repair_small

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 somehow the Silverlight project portion of the solution decided to remove itself from the build list.

Read more on How to fix updating problems in your Silverlight application…

Popularity: 3% [?]

How to fix strange errors in silverlight web services

fix you_smallThe 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, AddressTypeListCompletedEventArgs e)
at StronicoMain.ServerUtil.ServerUtilClient.OnAddressTypeListCompleted(Object state)
Line: 1
Char: 1
Code: 0
URI: http://www.servername.com/Silverlight.js

Read more on How to fix strange errors in silverlight web services…

Popularity: 7% [?]

How to automatically start a program in the tray

The Problem: There is no way to start a program minimized in the system tray

The Cause: The correct event is the Shown event, which is not intuitive (to me anyway).

Read more on How to automatically start a program in the tray…

Popularity: 1% [?]