开发者

ASP.Net send and receive file question

I'm completely blanking here. I've got 2 servers that cannot talk to each other via normal network traffic (like just copying a file). I can't get FTP setup on either server due to artificial company security constraints.

Server1 basically just has an exe on it that I have written, and it needs to send a file to Server2.

Server2 has a full blown asp.net website on it so I'm writing a .ashx page to handle receiving the file.

So...Server1 needs to make a call to server2 and send a file to it over http. Server2 needs to accept the file and save it to disk.

Where should I start? I know I can make server1 create a WebRequest object, and set the method to POST, and then stream the content.

But on server2, what am I supposed to write? A generic handler? Will my file that I send be part of the context.Request object? How do I get it out?

I feel like I'm missing something extremely basic and ju开发者_StackOverflow中文版st can't get my head around it.

Thanks for any pointers.


Ok: do you have any constraints as to framework? If not, I'd highly suggest you go the WCF route and use an IIS-hosted WCF service to upload your file.

There's even a helpful tutorial on the subject.


Create an ASPX page on Server2 and let it host a FileUpload control.

From the exe in Server1, host a browser control and request the ASPX page, and upload the file you want via the file upload control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜