installed my PC and installed all the service packs and patches.
But i just can not get my Angular Website to communicate with the WebApi. I keep getting the following message when i try to verify the UserName and password.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://myLocaldeployedSite:89/api/Account/GetUserByPost/
. This can be fixed by moving the resource to the same domain or enabling CORS.
http://myLocaldeployedSite:89/
is my WebApi that is deployed into IIS.
I have the following code changes in my code (as per the brockallen blog http://brockallen.com/2012/10/18/cors-iis-and-webdav/):
WebApi (web.config):
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
the headers for the call that i am making looks like this...
Host: localhost:89
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Origin: `http://localhost:2825`
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
the response in fiddler is a 200 - OK but in Firebug it displays the message mentioned above.
Here is also the image of the message :
And here is the response i found in Fire Bug :
But still i don't get the website to connect to my WebApi.
Please can someone assist. Have already referenced quite a few of the links in StackOverflow but have not succeeded yet so I hope that someone can assist.
Thank you.