Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...How to handle CORS in mobile app calling DNN 7 WebAPI ServicesHow to handle CORS in mobile app calling DNN 7 WebAPI Services
Previous
 
Next
New Post
4/27/2013 3:13 AM
 

I am writing an iPhone app using Jquery/HTML5 (PhoneGap). I exposed a HelloWorld WebAPI service in DNN as per this article. This all works great.

I made a simple HTML page to call the service via Jquery. This works fine if the HTML page is on the same domain/server, however when I call it locally I get the CORS error: 

XMLHttpRequest cannot load   "...DesktopModules/frameworkservices/api/.... Originhttp://www.dnndev.me is not allowed by Access-Control-Allow-Origin. 

From my understanding, ALL web Mobile APPS (not MVC or Mobile Websites) will have this problem, however it seems I am doing something wrong as no one has hit this problem before on DNN.

I tried the solution suggested here (updated web config and tried the attribute) but neither work. Am I doing something wrong?



Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
4/27/2013 4:50 AM
 
Hi Rodney,

DISCLAIMER - I know nothing about this, but it's caught my interest because I may have to do somthing similar.

A bit of googling hit this sample app:
http://coenraets.org/blog/2011/10/sam... - his service is PHP but that should not matter as your problem is at the client end

...and this...
http://stackoverflow.com/questions/12...

...which is not really your question, but includes two interesting lines...
jQuery.support.cors = true;
$.mobile.allowCrossDomainPages = true;

...which sound relevant to your situation. Maybe researching them will help you.

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
4/27/2013 5:00 AM
 
Thanks Richard, I checked you the SO link - however, this is a JQuery Mobile property (which I am not using, although I will look into this)

http://forum.jquery.com/topic/cross-d...

and it still needs to have the corresponding headers on the Server side.

I checked out Bruce's example here (DNNDash) and it does not seem to cater for it in the code.
https://dnndashservice.codeplex.com/S...

Also - it sounds like we are getting server-side CORS support in the next version of ASP web stack - http://weblogs.asp.net/scottgu/archiv... - I am reluctant to try the Nightly Builds... I'll keep googling...

Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
4/27/2013 6:10 AM
 
Take care with jQuery Mobile.

I know there are problems getting jQuery mobile to play nicely with WebForms and the ScriptManager. A pal of mine blogged about it

http://dotnet.learningtree.com/2012/1...

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
5/2/2013 7:48 AM
 
Hi,

Even I faced this problem. Developed web api and when I tried to consume using jquery, it was working fine when the web api was at my end, but it was showing error when I deployed the web api to different server.

Thanks,
Avinash Kumar
Mindfire Solutions

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...How to handle CORS in mobile app calling DNN 7 WebAPI ServicesHow to handle CORS in mobile app calling DNN 7 WebAPI Services


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out