[英]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.