将数据从经典ASP传输到AngularJS

时间:2022-11-26 01:35:37

I have two applications and want to pass data within them. Both applications are on different domains and different technology.

我有两个应用程序,想要在其中传递数据。这两个应用程序都在不同的领域和不同的技术上。

Application-1: www.mydomain.com
Application-2: www1.mydomain.com (Notice the "www1")

应用程序1:www.mydomain.com应用程序2:www1.mydomain.com(请注意“www1”)

Application-1 is in Classic ASP using hidden variables and forms. Application-2 is a SPA in AngularJS.

应用程序1在经典ASP中使用隐藏变量和表单。应用2是AngularJS的一个SPA。

Requirement: Click on a link from classic ASP which navigates you to AngularJS. Clicking "Cancel" on AngularJS page should redirect you back to classic ASP page.

要求:点击一个从经典ASP链接到AngularJS的链接。点击AngularJS页面上的“取消”按钮可以将你重定向到经典的ASP页面。

Problem: I can pass Classic ASP page URL in querystring but this page has 50 hidden form variables which I want to pass as well to AngularJS so that I can redirect back from AngularJS page with those form variables.

问题:我可以在querystring中传递经典的ASP页面URL,但是这个页面有50个隐藏的表单变量,我也想将它们传递给AngularJS,这样我就可以用这些表单变量从AngularJS页面重定向回来。

1 个解决方案

#1


0  

Since there is no issue parsing querystring parameters in Angular, is your issue more around how to easily pass the ~50 form items to your Angular app? If so, you can easily loop through the form elements and append them to a variable like so:

既然在角度上解析查询字符串参数没有问题,那么您更关心的是如何轻松地将~50个表单项传递给角度应用程序吗?如果是这样,您可以轻松地对表单元素进行循环,并将它们附加到如下的变量:

dim queryString

For Each item In Request.Form
   queryString = queryString & "&" item & "=" & request.form(item)
Next 

From there you would append the queryString to the end of your redirect and all of the form elements would be a part of the querystring.

然后将queryString附加到重定向的末尾,所有的表单元素都是queryString的一部分。

#1


0  

Since there is no issue parsing querystring parameters in Angular, is your issue more around how to easily pass the ~50 form items to your Angular app? If so, you can easily loop through the form elements and append them to a variable like so:

既然在角度上解析查询字符串参数没有问题,那么您更关心的是如何轻松地将~50个表单项传递给角度应用程序吗?如果是这样,您可以轻松地对表单元素进行循环,并将它们附加到如下的变量:

dim queryString

For Each item In Request.Form
   queryString = queryString & "&" item & "=" & request.form(item)
Next 

From there you would append the queryString to the end of your redirect and all of the form elements would be a part of the querystring.

然后将queryString附加到重定向的末尾,所有的表单元素都是queryString的一部分。