Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Cross-Domain by ASP.NET CORE

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "how to achieve cross-domain ASP.NET CORE", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "how to achieve cross-domain ASP.NET CORE"!

1. Background API interface

Create a Web API project using. Net core to provide data to the front-end interface.

Second, front-end interface

Set up two MVC projects, simulate different ip, and add buttons in the view to call the interface provided by WEB API to test cross-domain. The view view page code is as follows:

@ {Layout = null;} Cross-domain test 1 function btnGet () {$.ajax ({url: 'https://localhost:44355/api/values', type: "Get", dataType: "json", success: function (data) {alert ("success") }, error: function (data) {alert (failure);});}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report