1

I've got 2 projects: Core and Web.

Core project has API controllers, models, etc. Web project has html pages only.

I'm loading data from API using jQuery. When I do this exactly from Core project (created a view), everything is ok. But when I do this from Web project, I've got error 404, but Fiddler shows everything is ok.

Why is it so? What's a problem?

1
  • 1
    It's great that you found an answer and want to share it! Can you post it as an answer rather than an edit to the question though please? I've edited it out of the question for you but you can still see the older revision here: stackoverflow.com/posts/16632031/revisions. Commented May 19, 2013 at 16:56

1 Answer 1

1

I found the answer. That is because it's cross domain application. And it's necessary to implement CORS support. It can be done by two ways.

First. Add to section of web.config file next:

<httpProtocol>
 <customHeaders>
  <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" />
 </customHeaders>
</httpProtocol>

Second. Create custom MessageHandler. Like in this post

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.