Calling ASP NET Web API service in a cross domain using jQuery ajax

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024

Комментарии • 75

  • @othmanekid5892
    @othmanekid5892 7 лет назад +10

    Thanks for sharing. I both like your technical skills as your so zen way of transferring knowledge. Wish you all the good!

    • @Csharp-video-tutorialsBlogspot
      @Csharp-video-tutorialsBlogspot  7 лет назад +5

      Thank you very much for taking time to give feedback. This means a lot. I am very glad you found the videos useful.
      I have organised all the Dot Net & SQL Server videos in to playlists, which could be useful to you
      ruclips.net/user/kudvenkatplaylists?view=1&sort=dd
      If you need DVDs or to download all the videos for offline viewing please visit
      www.pragimtech.com/kudvenkat_dvd.aspx
      Slides and Text Version of the videos can be found on my blog
      csharp-video-tutorials.blogspot.com
      Tips to effectively use my youtube channel.
      ruclips.net/video/y780MwhY70s/видео.html
      If you want to receive email alerts, when new videos are uploaded, please subscribe to my youtube channel.
      ruclips.net/user/kudvenkat
      If you like these videos, please click on the THUMBS UP button below the video.
      May I ask you for a favor. I want these tutorials to be helpful for as many people as possible. Please share the link with your friends and family who you think would also benefit from them.
      Good Luck
      Venkat

    • @adityapathak9999
      @adityapathak9999 6 лет назад

      I did all the steps as mentioned in the viedeo and blog but my service generating exception
      An exception of type 'System.InvalidOperationException' occurred in WebApiContrib.Formatting.Jsonp.dll but was not handled in user code

  • @victormuthomi6291
    @victormuthomi6291 7 лет назад +1

    kudvenkat. You have speedened up the process of acquiring knowledge on APIs.
    You are also explaining it in a simple way even for complex concepts.
    This series is my first with you and I must say I love the videos.
    Good job sir!

  • @jasper5016
    @jasper5016 5 лет назад

    OMG, this is the best explanation I have heard for the Cross-domain.

  • @aamirjamal6833
    @aamirjamal6833 7 лет назад +3

    Only because you are so awesome with the videos that i feel the need to support you as much as possible, I don't skip any advertisement for your videos and like every video possible...

  • @shrutikittur7536
    @shrutikittur7536 8 лет назад +4

    Thank you so much for the Wonderful videos. Probably How many more to videos come for this Topic(Web API).You are a wonderful Teacher.

  • @Infinitesap
    @Infinitesap 3 года назад

    Been watching a lot of your videos. Are you an alien? (joking). The quality is simply out of this world. It's magnificent. Thanks very much for your effort.

  • @Tomersss222
    @Tomersss222 7 лет назад

    Wow, this video made me feel like i just ate the forbidden fruit of knowledge, everything becomes clear in seconds :-)

  • @adityapathak9999
    @adityapathak9999 6 лет назад +1

    You are doing good job. Just one request. When you say something Important then either change the tone or increase/decrease volume. Mind picks the things when there is change in either in tone or volumn.

  • @belmiris1371
    @belmiris1371 2 года назад

    That's pretty amazing! Thanks!

  • @AliHassanLearnMVC
    @AliHassanLearnMVC 8 лет назад +1

    Thank you for uploading in 720px

  • @folorunso
    @folorunso 8 лет назад +1

    Thanks for re-upload. God bless !!

  • @EvilApeOverlord
    @EvilApeOverlord 5 лет назад

    Great video. Thanks for your help!

  • @byamakesh91
    @byamakesh91 8 лет назад

    Thanks for re-upload better quality

  • @girijesh-mca
    @girijesh-mca 8 лет назад +1

    Great !!! Explanation

  • @conaxlearn8566
    @conaxlearn8566 3 года назад

    In Fiddler, we have to manually supply the callback function name otherwise we get that 500 error.
    In the JavaScript code in both html pages, we're not supplying the callback function name to the Uri and code works.
    In fact, if we manually supply the callback function name in the ajax call then we don't see any employee appear on the page.
    I'm assuming this is because jQuery automatically adds a callback function name when we specify dataType as 'jsonp'?

  • @poornitest2827
    @poornitest2827 7 лет назад +2

    Hi Venkat,
    All tutorials are very good.
    After including Jsonp package I am still getting error the below error,
    XMLHttpRequest cannot load localhost:63946/api/employee/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'localhost:53500' is therefore not allowed access. The response had HTTP status code 500.
    How to overcome this?

    • @anpham7946
      @anpham7946 7 лет назад

      change data:"jsonp" to dataType:"jsonp"

  • @tejaschinchwalkar8913
    @tejaschinchwalkar8913 2 года назад

    is jsonp needed to write at the place of datatype even projects and api exists in same solution .

  • @zithfrg
    @zithfrg 8 лет назад +1

    Super. Keep up the good work!

  • @clintongallagher
    @clintongallagher 7 лет назад

    Since we started working with jQuery in this series none of the jQuery API calls are working for me. Bummer.
    I don't know how he does it. The jQuery ajax does not work and JsonMediaTypeFormatter(config.Formatters.JsonFormatter) is the 1st overload and is a protected class that can't be reached from EmployeeService > WebApiConfig.cs

  • @chandrashekharMenariathecoder
    @chandrashekharMenariathecoder 4 года назад

    I am Getting below error when final run:
    An exception of type 'System.InvalidOperationException' occurred in WebApiContrib.Formatting.Jsonp.dll but was not handled in user code
    Additional information: A callback parameter was not provided in the request URI.

  • @amlanbdey
    @amlanbdey 5 лет назад

    With my limited knowledge I have a question that may sound silly, if the same url works fine from inside the HTML s even without any callback function how it gives the 500 internal error only during fidler? Is that error still allows the other domain HTML to get the data ? Can anyone please let me know?

  • @anuragmahajan606
    @anuragmahajan606 8 лет назад +1

    Please Upload Crud Methods like get_All, get_by_Id, insert,update,delete, using sqlservar in web Api , postman, without using entity framework

  • @systemsatyaki
    @systemsatyaki 7 лет назад

    I can get only output by calling localhost:51126/api/Employees in a cross domain using jQuery ajax, but if I am working a big project and API hosted on www.api.com , presentation layer hosted on www.presentation.com, then should I replace localhost:51126/api/Employees manually to www.api.com/api/Employees when I call from jQuery or Javascript ? please explain what is the best practise ?

  • @PrashantChaudhari38
    @PrashantChaudhari38 6 лет назад

    Hi sir... I tried this & it worked as shown i.e. on same server but diff domain but when I'm trying to access api of another server then it gives me error of CORS(IN Firefox this is shown as does error & in chrome it shows as similar to your error)
    Need guidance...

  • @mindeng2742
    @mindeng2742 7 лет назад +2

    Cross domain call does not work well. An error about "a callback parameter was not provided in the request URI" appeared.
    Please help. (but some domain request working well)

  • @senorsami01
    @senorsami01 7 лет назад

    Just verified that Edge & IE lets you do cross browser requests by default while Chrome errors out. Any ideas why?

  • @divyaswathi8905
    @divyaswathi8905 7 лет назад

    i got error the jsonp execute in browser...the error was Failed to load resource: net::ERR_CONNECTION_REFUSED.
    what can i do sir please help me

  • @amitchaurasiya689
    @amitchaurasiya689 3 года назад

    I recieve same issue but while consuming wcf service via ajax in asp.net c# ....need help

  • @ankur_upadhyay_
    @ankur_upadhyay_ 4 года назад

    Hi even after implementing jsonp in new web application project, still getting that cross domain error. Can someone suggest what I am doing wrong.

  • @yagappanmariasusai8746
    @yagappanmariasusai8746 4 года назад

    I get "The type or namespace name 'JsonpMediaTypeFormatter' could not be found (are you missing a using directive or an assembly reference?)". What is mean?

  • @mayurichirade4667
    @mayurichirade4667 3 года назад

    How do you keep the output window open and can do changes to the code in vs I mean how???

  • @gealglover2479
    @gealglover2479 4 года назад

    I am getting no data returned by either HtmlPage1.html or Employees.html. I get no error either. If I replace the "dataType: 'jsonp'" with "dataType: 'json'" in Employees.html I once again get data. Still nothing from HtmlPage1.html.

    • @omartorres333
      @omartorres333 4 года назад

      f the HtmlPage1.html is not giving back de information required, make sure that the jquery version in ClientApplication> Scripts>jquery-X.X.X.js corresponds to the one used in the html page, that wasn´t mentionned in the video, and may get ypu in trouble.

  • @gangadharkaranapu9062
    @gangadharkaranapu9062 5 лет назад

    1) Why we are not putting "call back" in query string of html ajax request?
    2) How jQuery is converting a callback response to normal object?

  • @Albshr77
    @Albshr77 8 лет назад +1

    Many thanks

  • @mohsinhamid6264
    @mohsinhamid6264 6 лет назад

    hi there my EmployeeService.html is working fine though its shows output bit late but HtmlPage1.html is not working with this error
    Failed to load localhost:51323/api/employees: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'localhost:49708' is therefore not allowed access. The response had HTTP status code 500.
    kindly reply fast
    thanks

  • @kavithavishwanathen6778
    @kavithavishwanathen6778 7 лет назад

    i only get output when i use localhost:51106/Employees.html?callback=ABC and localhost:49704/HtmlPage1.html?callback=ABC.....Sir can u tell me why so ?

  • @redki755
    @redki755 7 лет назад

    thank you,expecting mvc5 & mvc6 videos

  • @muhammadrehbarsheikh8498
    @muhammadrehbarsheikh8498 8 лет назад +1

    Thank u sir

  • @Prashantcharizard
    @Prashantcharizard 6 лет назад

    awesome..!!

  • @kavithavishwanathen6778
    @kavithavishwanathen6778 7 лет назад

    ThANK yOU sIR !!!!!!

  • @deepankarthegeyen6929
    @deepankarthegeyen6929 7 лет назад

    Thanks for the video, I am getting a peculiar error of Http Status code 500. The detailed error is given below, I am missing something, Can you please help me. Thanks in advance.
    "XMLHttpRequest cannot load localhost:53646/api/employees. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'localhost:53443' is therefore not allowed access. The response had HTTP status code 500." In IE it's showing SEC7120 and HTTP500 error.

  • @abonady6747
    @abonady6747 5 лет назад

    Hi Sir,
    First of all, thank you very much for these videos.
    Second, JSONP did not work with me, chrome is giving >> Access to XMLHttpRequest at 'localhost:58619/api/Employees' from origin 'localhost:7889' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
    Please advise.

  • @wil9861
    @wil9861 7 лет назад

    How does the Cors work in Asp.net MVC4 using jsonp or enabling Cors? Love your tutorials

  • @jinsu0101
    @jinsu0101 5 лет назад

    When adding JsonP dll reference in my Project, i got a error message.
    [HttpException (0x80004005): 'System.Net.Http.Formatting, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
    AnyBody help me~~

    • @jinsu0101
      @jinsu0101 5 лет назад

      I'm just trying this Solution.
      Solution 1: It seems that some dependencies are broken. Have you tried to reinstall NuGet package?
      From the package manager, run Update-Package Microsoft.AspNet.WebApi -reinstall.
      From: forums.asp.net/t/2042710.aspx?Error+loading+System+Net+Http+Formatting

  • @hendesebilisim
    @hendesebilisim 7 лет назад

    Thank you Sİr

  • @hanumanth446
    @hanumanth446 7 лет назад

    JsonMediaTypeFormatter class has a parameterized constructor but it's Access Modifier is Protected not the Public, so i can't use the JsonMediaTypeFormatter(config.Formatters.JsonFormatter); in WebApiConfig.Cs class. Can Someone help me here.

    • @SuperSunny92
      @SuperSunny92 7 лет назад +1

      Try writing "JsonpMediaTypeFormatter" instead of "JsonMediaTypeFormatter", you must install jsonp from Nuget packages.

    • @hanumanth446
      @hanumanth446 7 лет назад

      Ok, Thank you.

  • @hamidnawaz9678
    @hamidnawaz9678 6 лет назад

    but am not getting the data in the same domain what's reason behind ??? can anybody tells the reason??

  • @ASHOK_162
    @ASHOK_162 6 лет назад

    Can You please add tutorials on Web Api Authentication with Tokens like Bearer Token etc...

  • @srknagalla
    @srknagalla 3 года назад

    I did exactly the same both html pages were not displaying the data

  • @zainafzal4226
    @zainafzal4226 6 лет назад

    These videos are very helpful. Thank you ever so much for them. If you have a page for donation, please let me know.

    • @swapna0810
      @swapna0810 6 лет назад

      Good thought Zain. I just did the same. Here is the link for donating.
      www.pragimtech.com/donate_to_kudvenkat.aspx

  • @omartorres333
    @omartorres333 4 года назад

    If the HtmlPage1.html is not giving back de information required, make sure that the jquery version in ClientApplication> Scripts>jquery-X.X.X.js corresponds to the one used in the html page, that wasn´t mentionned in the video, and may get ypu in trouble.

  • @hameddeshmukh2099
    @hameddeshmukh2099 3 года назад

    can you make a video on upload package on S3 bucket by using web Api,and how to integrate the file upload external service

  • @MaheshSuthar08
    @MaheshSuthar08 8 лет назад

    Sir if i wants to hide the URL how can i do this?

  • @sujitsethi6433
    @sujitsethi6433 5 лет назад

    JsonpMediaTypeFormatter is prone to security breach as it sends a function which wraps the response

  • @RK-fr9bg
    @RK-fr9bg 6 лет назад

    Thank you so much great videos.
    How can i call my asp.net web api from my android app in visual studio??
    Please help

  • @lavleshjaiswal4997
    @lavleshjaiswal4997 3 года назад

    First of all i cou6 like to say special thanks for this video.
    Sir after adding jsonp reference filw from nuget i am getting error..
    Couldn't load file or assembly System.Net.Http.Formatting Version=5.0.0.0.
    Publictoket 31bf3856ad346e35.
    Exception from HRESULT 0x80131040.
    Please sir help me

  • @anithasunilkumar
    @anithasunilkumar 7 лет назад

    how can you create Jsonp formatter for google api services.

  • @gkmishra2009
    @gkmishra2009 5 лет назад

    please provide video on design pattern , no any video are good in youtube whatever i seen

  • @SadiqMsadiqsha
    @SadiqMsadiqsha 5 лет назад

    Hi sir,
    In Web api we have multiple get methods how to call specific get method.

    • @tusharkantidas4622
      @tusharkantidas4622 5 лет назад

      Using ActionName or Route tag above specific Get method.

  • @VCWGAMESTUDIO
    @VCWGAMESTUDIO 5 лет назад

    I am getting same error ....cros orgin

  • @csharpkrsna
    @csharpkrsna 7 лет назад

    How to do a post then ?