Click here to Skip to main content
15,887,251 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionOpen template word doc and replace values Pin
byka14-Mar-17 5:34
byka14-Mar-17 5:34 
SuggestionRe: Open template word doc and replace values Pin
CHill6014-Mar-17 5:43
mveCHill6014-Mar-17 5:43 
AnswerRe: Open template word doc and replace values Pin
Richard Deeming14-Mar-17 6:54
mveRichard Deeming14-Mar-17 6:54 
GeneralRe: Open template word doc and replace values Pin
byka14-Mar-17 8:09
byka14-Mar-17 8:09 
GeneralRe: Open template word doc and replace values Pin
Richard Deeming14-Mar-17 11:06
mveRichard Deeming14-Mar-17 11:06 
QuestionDotnet Core Reference Issue Pin
S_A_S9-Mar-17 0:11
S_A_S9-Mar-17 0:11 
AnswerRe: Dotnet Core Reference Issue Pin
Afzaal Ahmad Zeeshan14-Mar-17 11:53
professionalAfzaal Ahmad Zeeshan14-Mar-17 11:53 
QuestionApi post call works on postman but in mobile app or ajax call it doesn't Pin
mrkeivan8-Mar-17 18:36
mrkeivan8-Mar-17 18:36 
here's the problem
I've got an API with the following address (HTTP post)

JavaScript
http://api.novin.solutions/api/member/login
      "headers": {
        "accept": "application/json",
        "content-type": "application/x-www-form-urlencoded"
      },
    
      "data": {
        "username": "mrkeivan",
        "password": "09126101185",
        "uiId": "d960a994-0972-44ba-ae2c-2c3a01e135c1"
      }


I need to call this api in another website and a mobile application, to do so I enabled Asp.net APi Cores globally in web config and WebApiConfig.cs

**in WebApiConfig.cs**

config.EnableCors(new EnableCorsAttribute("*", "*", "*"));

> as well as Web.config

XML
<httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Methods" value="POST, PUT, DELETE, GET, OPTIONS" />
        <add name="Access-Control-Allow-Headers" value="content-Type, accept, origin, X-Requested-With, Authorization, name" />
        <add name="Access-Control-Allow-Credentials" value="true" />
      </customHeaders>
    </httpProtocol>


when I call this in postman, it works perfectly
however when I call it through an ajax method or a friend of mine calls it in his mobile app project it returns the following error

> XMLHttpRequest cannot load
> http://api.novin.solutions/api/member/login. Response for preflight
> has invalid HTTP status code 404 OPTIONS
> http://api.novin.solutions/api/member/login 404 (Not Found)


I have read many articles in this matter and applied all the suggestions, but nothing fixed my problem Frown | :(

any help would be appreciated
AnswerRe: Api post call works on postman but in mobile app or ajax call it doesn't Pin
F-ES Sitecore8-Mar-17 23:08
professionalF-ES Sitecore8-Mar-17 23:08 
GeneralRe: Api post call works on postman but in mobile app or ajax call it doesn't Pin
mrkeivan9-Mar-17 0:05
mrkeivan9-Mar-17 0:05 
GeneralRe: Api post call works on postman but in mobile app or ajax call it doesn't Pin
F-ES Sitecore9-Mar-17 0:18
professionalF-ES Sitecore9-Mar-17 0:18 
GeneralRe: Api post call works on postman but in mobile app or ajax call it doesn't Pin
mrkeivan9-Mar-17 17:56
mrkeivan9-Mar-17 17:56 
GeneralRe: Api post call works on postman but in mobile app or ajax call it doesn't Pin
F-ES Sitecore9-Mar-17 22:51
professionalF-ES Sitecore9-Mar-17 22:51 
GeneralRe: Api post call works on postman but in mobile app or ajax call it doesn't Pin
mrkeivan9-Mar-17 23:35
mrkeivan9-Mar-17 23:35 
GeneralRe: Api post call works on postman but in mobile app or ajax call it doesn't Pin
mrkeivan9-Mar-17 18:54
mrkeivan9-Mar-17 18:54 
SuggestionRe: Api post call works on postman but in mobile app or ajax call it doesn't Pin
Richard Deeming9-Mar-17 1:18
mveRichard Deeming9-Mar-17 1:18 
GeneralRe: Api post call works on postman but in mobile app or ajax call it doesn't Pin
mrkeivan9-Mar-17 17:57
mrkeivan9-Mar-17 17:57 
QuestionASP.NET C# -STRING PROCESSING Pin
batman568-Mar-17 18:04
batman568-Mar-17 18:04 
SuggestionRe: ASP.NET C# -STRING PROCESSING Pin
Richard MacCutchan8-Mar-17 21:17
mveRichard MacCutchan8-Mar-17 21:17 
AnswerRe: ASP.NET C# -STRING PROCESSING Pin
Richard Deeming9-Mar-17 1:15
mveRichard Deeming9-Mar-17 1:15 
QuestionError Inserting data - into the database. Pin
samflex6-Mar-17 3:28
samflex6-Mar-17 3:28 
AnswerRe: Error Inserting data - into the database. Pin
Richard MacCutchan6-Mar-17 5:36
mveRichard MacCutchan6-Mar-17 5:36 
GeneralRe: Error Inserting data - into the database. Pin
samflex6-Mar-17 6:19
samflex6-Mar-17 6:19 
GeneralRe: Error Inserting data - into the database. Pin
Richard MacCutchan6-Mar-17 6:25
mveRichard MacCutchan6-Mar-17 6:25 
GeneralRe: Error Inserting data - into the database. Pin
samflex6-Mar-17 7:01
samflex6-Mar-17 7:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.