Aug 30, 2016


I've struggled quite a bit to get CORS working with an .NET web application hosted by IIS, but finally got it working with Windows authentication.

Here are the necessary requirements:

  1. The application pool must be running in Integrated mode, not Classic mode.
  2. You have to add a simple  HTTP module to your web service C# code to respond to the OPTIONS call without authentication: 
  3. public class CORSModule : IHttpModule
        public void Dispose() { }
        public void Init(HttpApplication context)
            context.PreSendRequestHeaders += delegate
                if (context.Request.HttpMethod == "OPTIONS")
                    var response = context.Response;
                    response.StatusCode = (int)HttpStatusCode.OK;
  4. You need to add these Header lines to the web.config:
  5. <?xml version="1.0" encoding="utf-8"?>
            <add name="Access-Control-Allow-Origin" value="https://myserver" />
            <add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />
            <add name="Access-Control-Allow-Headers" value="Accept,Authorization,Content-Type,SOAPAction,X-RequestDigest" />
     <add name="Access-Control-Request-Headers" value="Content-Type,Authorization,Accept,SOAPAction,X-Requested-With" />
            <add name="Access-Control-Allow-Credentials" value="true" />
        <add name="CORSModule" type="CORSModule" />
  6. You need to add the "WithCredentials: true" to your JavaScript Ajax call to pass the Windows credentials if you're using Windows authentication.

Jun 17, 2016

SharePoint BCS: External content type not available for creating External List

I recently created a simple external content type for a WCF service in SharePoint 2013, but though I could create an external column that worked perfectly, the type was not available as an external list.

My problem was that I had added a PageNumber filter for the Finder (Read list items operation) to limit the items returned and activate pagination.

It seems External Lists do not support this and upon removing the filter from the operation, my content type was now available. This does work for SQL based external types.

Jan 25, 2016

Azure web app won't download my file because of the mimetype

If you have a non-standard file without a common mimetype (eg. dwg files for AutoCAD), Azure Web App sites won't serve them and instead give a 404 error.

This is a policy decision dating back to IIS 6.0.

The fix is simply adding the unknown mimetype to the web.config for the Azure Web App:

For example:

         <mimeMap fileExtension=".dwg" mimeType="application/acad" />

Broken connection between Jetpack and

I had a problem with another blog I maintain in a hosted WordPress installation that uses the Jetpack plugin for statistics and other services.  Upon upgrading some modules, the Jetpack plugin lost the connection to and restoring the database didn't help.  I didn't know the username or email associated with the account and panic began to set in.

In desperation, I contacted Wordpress support and they informed me that I could simply create a new account and if I connect it to the same domain, all the site information would be maintained, as all data is stored with the domain identity.

It worked like a charm!  Phew!!

May 2, 2015

Save site template missing in SharePoint Online and Office 365

So by now you've noticed that they've removed the site command "Save site as template"  in SharePoint Online and you don't know what to do.

1. Make sure you're not trying to make a template from a publishing site.  SharePoint has difficulty creating site templates from publishing sites.

2. Browse to and save your template as always.

3. I'm not sure how long this method will work, but I'm sure an app could handle this no problem.

Apr 9, 2015

SharePoint 2013 workflow 255 character limit for string variables

In all my years of SharePoint workflows, I had never come across the 255 character limit for strings until recently.  I tried lots of solutions until this one ocurred to me:

Instead of using a string variable, create a multiline input parameter.  You can then use it as you would a regular variable, concatenating text onto it, without running into problems.  

Be aware that not all workflow actions can handle strings longer than 255 characters.
Working actions:
  • Email

Not working:
  • Log to history

The limitation on storage size for any SharePoint 2013 workflow variable is 256KB, so you should have about a 64,000 UTF-8 character limit (not tested).

Jan 13, 2015

Broken SharePoint 2013 webpart page

If you've been editing custom pages using SharePoint Designer, you know how fragile they can be. 

A wrong key can break a page that worked a few minutes ago and you get the generic error:

 "Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator."

  1. Routinely create backup copies of the page for comparison and restoration
  2. SharePoint Designer likes to randomly add &nbsp; characters to your markup which will break the page.  Search for and delete these.
  3. Never delete the original new form from a page.  Hide it, but never delete it.  This will keep the attachment functionality working correctly.