title: responding policy-file-request of flash from c#
body: <p>i have developed a server application with c# and a client application with flash action script 3.0. Flash socket asking for a policy file when called from a browser with a message </p>
  
  <pre><code>&lt;policy-file-request/&gt;
  </code></pre>
  
  <p>everything is normal so far. My server is waiting for this message and sending to client a policy file string which is like this:</p>
  
  <pre><code>public const String POLICY_FILE = "&lt;?xml version=\"1.0\"?&gt;\n" +
      "&lt;!DOCTYPE cross-domain-policy SYSTEM \"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd\"&gt;\n" +
      "&lt;cross-domain-policy&gt;" +
      "&lt;allow-access-from domain=\"*\" to-ports=\"*\" /&gt;" +
      "&lt;/cross-domain-policy&gt;\u0000";
  </code></pre>
  
  <p>this string is being sent this way:</p>
  
  <pre><code>if (message.Contains("policy-file-request"))
              {
                  client.Send(Encoding.ASCII.GetBytes(Statics.POLICY_FILE));
                  return;
              }
  </code></pre>
  
  <p>I'm pretty sure that this was working but i really don't know what happened and started not working. When flash client receives this message from server, connection was succesfull and everything was going how it had to go. But now the flash client waits 20 seconds (timeout of flash socket) and throws security exception</p>
  
  <pre><code>[SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"]
  </code></pre>
  
  <p>I'm stuck and can't move forward. I'm listening to port 963, server machine fully qualified name is "mypc.domain.local" which can be accessible across my network. there is also an IIS running on this machine and the flash application is hosted here.</p>
  
  <pre><code>http://mypc.domain.local:90/page.html 
  </code></pre>
  
  <p>this is the way, i call my flash application and</p>
  
  <pre><code>mypc.domain.local:963
  </code></pre>
  
  <p>is the address of server running. i am also working on this machine. i tried calling the page <code>http://localhost:90/page.html</code> or <code>http://127.0.0.1:90/page.html</code> and also tried the connection to server as localhost:963 or 127.0.0.1:963. same result on every combination.</p>
  
  <p>What is wrong here? what could have been changed causing my working code broke down?</p>
  
  <p>Thanks.</p>