Login page returning CORS error in mobile project

Im trying first attempt on a mobile app, but cant get past the login page. Keep getting this error:
“Access to XMLHttpRequest at ‘https://express.tw6.no/dmxConnect/api/car/login.aspx’ from origin ‘http://localhost:12345’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
serverconnectForm.js:262 POST https://express.tw6.no/dmxConnect/api/car/login.aspx net::ERR_FAILED” when trying to log in
All the server actions are in a site on my webserver, and every page using the same servera ction is working fine there.

One or two solutions here you can take a look at as discussed previously.

Two fixes discussed. Using the CORS domain entry found within Server Connect, and the second deleting the Whitelist plugin folder within your application. More than likely one of them will help to resolve your issue.

No differce I’m afraid. I even tried publishing tha pages to my webserver (On a different subdomain from the server actions) but still the same. No error messages, but the login just will not work.
This is the test site: https://app.tw6.no/www/index.html user and pass are : 1

If I put this code in the web.config file on the subweb containing the server actions, the error dissappears in developer tools, but it is still not working:

  <httpProtocol>
    <customHeaders>
      <add name="Access-Control-Allow-Origin" value="*" />
    </customHeaders>
  </httpProtocol>

UPDATE. I deleted the server connect form on my mobile page, and now I’m redirected to the next page. But the user identity is not saved, so the next page does not work.
NB: The * must be added to all earlier created server connect files

The * for CORS in Server Connect is enabled globally for the whole site. However old settings might be cached so you want to purge all caches and restart app/browser

OK, thanks. Any ideas on how to make security provider and login work?

1 Like

Hello I am having the same problem with login and security provider on mobile projects. Did you get it to work by any chance?

We have already a CORS option in Server Connect for a while that you have to enable:

image

I know, but it still did not work, when clicking the wheel I only got an empty frame… Got it to work by deleting all connections and starting all over. This has happened with other sites also, server connect problems when copying sites