Posts

Browser / Document Compatibility

While changing a client's existing code, I ran into some compatibility issues with IE9 and some existing code.  The client had only tested up to IE8 with the current release but their customers were having issues with what turned out to be IE9 and its ability to process the same JavaScript.  So the client would not have to change the custom control immediately, I added the following to the Master Page: <head runat="server">     <title>master title</title>     <%--Mimic Internet Explorer 8--%>     <meta http-equiv="X-UA-Compatible" content="IE=8" /> </head>    And while I was looking for the Meta tag syntax, I ran into this which I didn't realize .Net could do: <asp:Label runat="server" ID="labelText"     ie:Text="This is IE text"     mozilla:Text="This is Firefox text"     Text="This is general te...

Re-Throwing Exceptions Across Project and Process Boundaries

In reworking a customer’s error handling framework, I wanted to be able to write one error capturing process without having to reference the code across different projects.  I simply wanted to catch the error at the point of failure with a try-catch, perform any error handling locally and then rethrow the error to the calling UI process so that the UI layer could decide what message to display.  So for a database duplicate key I could display, something like "Item already exists".  I also wanted to capture the error in one project.  I didn’t want the error capturing results spread across different machines when the solution is scaled if the database was unavailable to house the error.  Also, because different applications shared the same middle tiered objects, I didn't want extra logic to determine the what UI was making the call when capturing the error.  I wanted a simple but elegant solution.  Logically, it seemed to me that this should be done ...

Catastrophic Faillure and Delay Notification issues with WCF

Image
Before adding some new functionality to a customer’s existing site, my development runtime environment would hang, throw a timeout exception and after about a minute later a Catastrophic Failure message would appear. I also noticed a Visual Studio icon appeared in my system tray giving me a Delay Notification message. So I set break points at the entry points of the possible services having an issue but the code would never get executed.   After turning on Service Tracing and sifting through tons of information, I found the issue and saw this in the Tracing Viewer (bold text below is key): <E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">             <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">                         <E...

http Downloading Files and Browser Issues

While working on a project, I needed to download a document from the database and stream it to the client.  Our standard browser was IE 7+ and the standard code implementation documented throughout many forums the following with the first line simply obtaining the file via a service:   byte[] fileContents = csc.GetFileContent(this.CurrentContentId); Response.ClearContent(); Response.ContentType = this.ContentType; Response.AddHeader("content-disposition", string.Format("attachment;        filename={0}", this.ContentFileName)); Response.AddHeader("content-length", fileContents.Length.ToString()); Response.BinaryWrite(fileContents); Response.Flush(); Response.End();  The " Response.End() " at the end will cause a ThreadAbort exception within IE and other browsers.  The solution to this was to wrap this code inside a try-catch block and absorb the ThreadAbortException as follows: try  {    ...