Click here to Skip to main content
15,849,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have Uploaded data in cross browser using **AWS instance** sucessfully.But when I am trying to do the same on **windows Azure** I got the following error:

**Cross-Origin Request Blocked: The Same Origin Policy disallows reading the
remote resource. This can be fixed by moving the resource to the same domain
or enabling CORS**

My Post method is given below :

                type: 'POST',
                crossDomain: true,
                url: '',
                data: form_data,
                contentType: false,
                cache: false,
                processData: false,
                async: true,
                success: function (data) {                   
                    alert("Upload Successful! You can run a job once the data is configured");                    
                error: function (xhr, ajaxOptions, thrownError) {
Updated 14-Apr-16 23:52pm

You have not shared your API Code but check below EnableCors() method and if it is not implemented then implement it.

public static class WebApiConfig
    public static void Register(HttpConfiguration config)

Share this answer
After enabling Cors option please change your web.config as follow.

        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Headers" value="Content-Type" />
        <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
 <ModSecurity enabled="false" configFile="C:\inetpub\wwwroot\owasp_crs\modsecurity.conf" />
    <validation validateIntegratedModeConfiguration="false" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900