【发布时间】:2015-01-05 17:53:58
【问题描述】:
我正在为桌面应用程序开发许可。一个简单的工作流程:
- 用户的详细信息通过 HttpPost 方法提交到服务器(或其他)
- 服务器检查详细信息并生成文件。
- 服务器向用户发送文件(作为确认)
我需要关于第 3 步的帮助 - 如何向用户发送文件?
例如用户(HttpPost)
var client = new HttpClient();
var pairs = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("serialNumber", "AAAA"),
new KeyValuePair<string, string>("email", "test@123"),
new KeyValuePair<string, string>("HWID", "AAAA-BBBB-CCCC-DDDD"),
};
var content = new FormUrlEncodedContent(pairs);
var response = client.PostAsync("https://localhost:44302/testCom.aspx", content).Result;
if (response.IsSuccessStatusCode)
{
//Code for file receiving?
}
服务器
protected void Page_Load(object sender, EventArgs e)
{
//Check license ID
//Issue license file - How to?
//Mark database
}
【问题讨论】:
-
对于那种场景,你要实现Web Service (如Web API)而不是ASP.Net Web Form .
-
向我们展示您已经尝试过的东西总是很好的。我希望互联网上会有一些教程......
标签: c# asp.net httprequest httpresponse