Authentication error querying Dynamics CRM OrganisationService May 02, 2015 An IIS website we had that queries the Dynamics CRM (2011) OrganisationService was getting ”[SecurityNegotiationException: The caller was not authenticated by the service.]“ Thrown back at it when being accessed under certain circumstances (I forget exactly what they were, although I do remember it being a huge pain in the butt). The Service was instantiated using CredentialCache.DefaultNetworkCredentials as in many examples. The problem was that those client credentials were not being impersonated correctly even though impersonation and windows auth was enabled in IIS. ...
IIS returns 404 on all .woff files Nov 10, 2014 For some reason (tell me if you know why) IIS does not seem to like .woff files, and any attempt to load them for use in CSS will be met with a 404. I found a solution to it here, and it is to paste the following into your web.config’s system.webserver section: <staticContent> <remove fileExtension=”.woff”/> <mimeMap fileExtension=”.woff” mimeType="application/x-font-woff” /> </staticContent> Which fixed the problem immediately!
IIS - Preventing URL Access to a Specific Directory Oct 09, 2014 Yesterday I was asked to made a web page which provided the ability to download files, which weren’t served directly (by passing the file URL to the client) but were sent by reading the file on the server and sending the output. However, I realised that the files could still be accessed by an unauthenticated user by typing in the file’s direct URL. Most solutions to this that I found required remote access to the server (which I don’t have) or adding URL rewrite rules (the URL rewrite module wasn’t installed). ...
Preventing the Dynamics CRM Outlook add-in from creating contacts, forever Sep 25, 2014 It’s an ongoing issue here wherein a misconfigured / misbehaving Outlook client sometimes creates duplicate or redundant contacts in our CRM, and I’ve seen many blog posts and forum threads discussing the various ways of getting around it. Unfortunately they all require user-specific configuration, whereas I wanted to banish the problem across the board once-and-for-all. Completely by accident I came across a solution, which in retrospect is extremely obvious and I’m rather embarrassed that I didn’t figure it out sooner! ...
jQuery ajax error logging on the server with log4net Sep 17, 2014 This post is based on Toby Gundry’s post on the same technique, but adapted for logging jQuery ajax errors (although I added a few extra things too). In your Javascript: $(document).on({ ajaxError: function (event, jqXHR, ajaxSettings) { var err = “Location: " + document.location.href + “; “; if (jqXHR) { err += “Status: " + jqXHR.status + “; “; err += “Text: " + jqXHR.statusText + “; “; } if (jqXHR. ...
Dynamics CRM - error publishing entity, role does not exist Aug 05, 2014 This morning I was trying to add a new option to an option set field for a custom entity I had made earlier, however an error dialog popped up which said “The requested record is unavailable or you have insufficient permission to view the record”, even though I’m in a System Administrator role. Upon downloading the exception details and examining them, the actual error was this: role With Id = dba45c71-05e2-e311-9210-0050568f0001 Does Not Exist ...
T-SQL: Easy way to check for existence of a temp table Jul 30, 2014 Normally I’d do something like selecting from sysobjects to find if a temp table exists, but I found this little gem to drop a global temp table at the start of a query (in case it wasn’t cleaned up in the previous execution): IF(object_id(‘tempdb..##tmpTable’) IS NOT NULL) DROP TABLE ##tmpTable GO I’m sure you can come up with a better way to do this rather than using a global temp table, but a local one wasn’t going to work in this context since I was using a combination of EXEC and OpenQuery to select from Active Directory, and regular local temp tables seem to disappear upon leaving EXEC, perhaps due to the connection changing or something? ...
IIS and ASP.NET 404 error handlers don't play nicely together Jul 24, 2014 While trying to setup both ASP.NET as well as IIS error-handling, I noticed that IIS wasn’t dealing with certain 404 errors in which the file extension was wrong. For example, I could request ThisFileDoesntExist.aspx and that would redirect to NotFound.aspx just fine, but WrongExtension.aspz would kick the user out to the ugly default IIS 404 error page. So I did a bit of investigation and found this post, which pointed out that, in your web. ...
Visual Studio - 'Find was stopped in progress' May 29, 2014 Sometimes you’ll do a Find for “Entire Solution” (Ctrl + Shift + F is a handy shortcut) and instead of finding anything, the “Find Results” window will immediately display “Find was stopped in progress” with zero results. I usually deal with it by restarting Visual Studio or my computer, but this time I decided to actually look into it. Turns out it was a lot more common than I thought and is apparently a Windows bug, not Visual Studio, and goes way back to 2004. ...
The JSON deserialisation drinking game May 27, 2014 Take a drink every time you see this pattern: $.ajax({ data: “{things:stuff}", dataType: “json”,  //other properties omitted success: function (result) { var myObject = eval( “(” + result.d + “)" ); //noooooooooooooooo } }); Take a drink when someone seriously brings up the catchphrase “eval is evil” or a variant of it. Finish all of the drinks if you sincerely think that nobody would ever get malicious code into your database/application that will be happily executed when eval evaluates it and send your client to their phishing duplicate of your login page where they harvest user credentials before redirecting them right back to your application so nobody ever realises what just happened. ...