简体   繁体   English

如何使用 post 将数据传递到另一个 .Net Core Web 应用程序

[英]How to pass data to another .Net Core web application using post

I have a use case where I need to redirect to another web app but pass it some string data.我有一个用例,我需要重定向到另一个 Web 应用程序,但将一些字符串数据传递给它。 What is the best way to do this?做这个的最好方式是什么? Should I use a query string or instead of controller code store the data in the web browser - not sure how to do this in .Net.我应该使用查询字符串还是控制器代码将数据存储在 Web 浏览器中 - 不确定如何在 .Net 中执行此操作。 Below I want to send the urlToReturn to the app I am re-directing to:下面我想将 urlToReturn 发送到我要重定向到的应用程序:

  [HttpPost]
  public IActionResult Index()
  {
      string urlToReturn = "http://consumingapp.com";

      return Redirect("https://ComponentApp.azurewebsites.net";
  }

You mean something like:你的意思是这样的:

[HttpPost]
public IActionResult Index()
{
  string urlToReturn = "http://consumingapp.com";

  return Redirect($"https://ComponentApp.azurewebsites.net?redirectTo={urlToReturn}";
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在重定向到asp.net Core 2.0中的另一个Web应用程序之前先处理数据 - How to massage data before redirect to another web application in asp.net core 2.0 如何将View返回到.net核心Web应用程序中的另一个项目(模块) - How to return View into another project (modules) in .net core web application 如何使用asp net core http客户端将文件和文本数据发布到web api? - How can i post both file and text data to web api using asp net core http client? 使用 ASP.NET Core MVC 将带有文件的数据发布到 api (ASP.NET Core Web API) - Post data with files using ASP.NET Core MVC to api (ASP.NET Core Web API) 如何将数据发布到另一个Web应用程序(跨域) - How to POST Data to another web application (cross domain) 如何在调用.Net core web api post方法时将integer数组作为请求体传递 - How to pass integer array as request body while calling .Net core web api post method 如何使用HTTP POST将数据集传递到Web API - How to pass Data set to web API using HTTP POST 将PDF结果传递到ASP.NET Core中的另一个Web API - Pass PDF result to another web api in ASP.NET Core 将文件从 ASP.NET Core web api 发布到另一个 ASP.NET Core web api - Post files from ASP.NET Core web api to another ASP.NET Core web api 我可以从.NET Web应用程序将数据(用户名和密码)发布到另一个网站以进行登录吗? - Can i post data(username and password) to another website from my .NET web application to get login?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM