ASP.Net Web API Error: No Access-Control-Allow-Origin header is present on the requested resource

Last Reply 3 months ago By dharmendr

Posted 3 months ago

I have created web api using entity framework asp.net

but when I wanted get data from the same api from another domain got the following error. 

No Access-Control-Allow-Origin header is present on the requested resource.

I searched in the google and there are many solutions but I couldn't understand what is the more secure method for this allow and below is one of them

<system.webServer>
    <httpProtocol>
        <customHeaders>
            <!-- Adding the following custom HttpHeader 
                 will help prevent CORS from stopping the Request-->
            <add name="Access-Control-Allow-Origin" value="*" />
        </customHeaders>
    </httpProtocol>
</system.webServer>

 

You are viewing reply posted by: dharmendr 3 months ago.