The reason is that your GenerateAuthenticationHeader uses the server name. When you make a request to what is interpreted as a different domain you will get an error.You might try putting your IP address in your Internet explorer trusted sites and then change the IE options to allow cross domain requests, but the simplest solution is to just use the server name when you open Microsoft Dynamics CRM.
Nicola Grillo