i new angular js . today while writing code came accross error xmlhttprequest cannot load http://localhost:8090/timesheetlog/validateuser/we/we. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:55273' therefore not allowed access.
1: http://i.stack.imgur.com/ouhtv.png
controller code
in trying access wcf service in controller code ..
so problem lies not in angularjs code, on server. using web server? see have asp.net tagged in question, if case, in handler can put:
public void processrequest(httpcontext context) { context.response.appendheader("access-control-allow-origin", "*"); } that should allow cors, need.
you need modify web.config include:
<system.webserver> <httpprotocol> <customheaders> <add name="access-control-allow-origin" value="*" /> </customheaders> </httpprotocol> <handlers> <add name="examplehandler" verb="*" path="examplehandler.ashx" type="examplenamespace.examplehandler, examplenamespace, version=1.0.0.0, culture=neutral" /> </handlers> </system.webserver>
Comments
Post a Comment