Web应用程序通信以生成文档 [英] Web app comunication to generate documents
问题描述
所以我运行了2个ASP.NET MVC Web应用程序。
第一个接收数据并将其发送到第二个。
第二个应用程序获取数据并构建PDF然后返回PDF。
使用简单的方法很好用
@ Html.actionlink(URL,Download File,new {a = Model.a,b = Model.b,c = Model.c},New {target =_ blank}}
然后我开始使用更长的数据来模拟实际数据,我在IE的URL长度限制方面遇到了麻烦。
有没有办法使用post方法表单将这些数据传递到第二个应用程序,以便使用请求主体而不是URL栏,如果是这样,我将如何做到这一点?
我尝试了什么:
就像我在上面说的一个简单的动作链接
@ Html.actionlink(URL,下载文件,新{a = Model.a,b = Model.b,c = Model.c},新{target =_ blank} )
这在其他浏览器上运行良好但不幸的是IE限制了URL的大小,而且我的数据太长了。
我也尝试使用AJAX POST发送效果很好的数据,直到你得知你不能对返回的PDF做任何事情。 (我想也许我可以把它作为HTML发布到一个新窗口,它会捕获文件标题并提示下载但不是:(...)
任何帮助将不胜感激
谢谢,
So i have 2 ASP.NET MVC web apps running.
The first one takes in data and sends it to the second one.
The second App takes the data and builds a PDF then returns the PDF.
This was working well using a simple
@Html.actionlink("URL", "Download File", new { a = Model.a, b = Model.b, c = Model.c}, New{target = "_blank"})
But then i started to use longer data to simulate the actual data and i am having trouble with IE's URL length limitation.
Is there any way to get this data to the second app using a post method form in order to make use of the request body rather than the URL bar, and if so how would i do this?
What I have tried:
like i said above a simple action link something like
@Html.actionlink("URL", "Download File", new { a = Model.a, b = Model.b, c = Model.c}, New{target = "_blank"})
this works well on other browsers but unfortunately IE limits the size of the URL and my data is too long for it.
I also tried using an AJAX POST to send the data which works great until you learn that you cant do anything with the returned PDF. (i thought maybe i could post it to a new window as the HTML and it would catch the file header and prompt a Download but nope :(... )
any help would be greatly appreciated
Thanks,
推荐答案
结束使用提交动作构建表单:第二个应用程序的网址,方法:发布为longass字符串和btn提供隐藏的编辑器输入以提交表单。由于第二个站点只是尝试返回一个文件,浏览器不会尝试从它重定向到一个页面而是yay。如果有人有任何更好的想法我会很高兴听到他们
Ended up building a form with submit action:url of 2nd app, method:post putting hidden editor inputs for the longass strings and btn for submitting the form. Since the second site is trying to return only a file the browser doesn't try to redirect to a page from it and yay. If anyone has any better ideas i would be glad to hear them
这篇关于Web应用程序通信以生成文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!