构建下载WS(c#) [英] Building a download WS (c#)

查看:127
本文介绍了构建下载WS(c#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个Web应用程序,我有一个ExtJS(4.1)GridPanel,我愿意将数据导出为XML(意图用Excel打开),这个程序应该是服务器所以服务器会发送一个链接到客户端。这是我的问题。我不知道如何编写我的WebService,因此它将链接发送给客户。



请帮忙吗?

I''m building a web application, in wich i have an ExtJS (4.1) GridPanel, from wich i''m willing to export data as an XML (meant to be open with Excel), this procedure should be server side, so the server will send a link to the client. And this is my problem. I don''t know how to write my WebService, so it send the link to the Client.

Any help please ?

推荐答案

使用JavaScript和WebService,您无法将字节数组保存到文件系统中。你应该做的是创建一个通用下载页面,它接受一个*唯一的1次密钥*(可能是一个GUID),指向要在查询字符串上下载的文件。然后从您的客户端页面调用您的Web服务生成该文件,并返回下载密钥。然后,您可以动态地将iFrame添加到页面并将位置设置为下载页面,或者只需将当前页面的位置设置为下载页面,系统将提示用户保存文件。
Using JavaScript and a WebService you aren''t going to be able to save a byte array to the file system. What you should do is create a generic download page that accepts a *unique 1 time key* (maybe a GUID) that points to the file to download on the query string. Then from your client side page call your webservice to generate the file and have that return the key for the download. Then you can either dynamically an iFrame to your page and set the location to the download page or you can just set the location of the current page to the download page and the user will get prompted to save the file.


你的答案对我来说似乎是合乎逻辑的,我正在研究一个我发现的解决方案,如果它不起作用,我会看看你的解决方案。感谢您及时回复 !

祝你好运!
Your answer seem logic to me, I''m working on a solution that I found out, if it doesn''t work I will take a look at your solution. Thanks for the quick answer !
Best regards !


这篇关于构建下载WS(c#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆