Is it possible to send file from one web page to another in asp.net

余生长醉 提交于 2019-12-10 20:47:59

问题


i have two domains like domain1 and domain2.

I'm uploading file to domain1's server with server.SaveAs method which uploads file to domain1

i want to upload same file to domain2 as well as domain1. can you people suggest me how can i do that.

how can i pass docx file into querystring ?

please do not ask me to use ftp.


回答1:


You can upload file to other domain from the server side using the WebClient.UploadFile When the file is uploaded to the domain of current page and is saved. You can upload it to other domain using the URL.

string fileName = "PhysicalPath";
WebClient myWebClient = new WebClient();
byte[] responseArray = myWebClient.UploadFile(uriString,fileName);



回答2:


Issue resolved when we created an asp.net web api and deployed it to 2nd domain.



来源:https://stackoverflow.com/questions/23751049/is-it-possible-to-send-file-from-one-web-page-to-another-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!