【发布时间】:2014-06-12 10:48:17
【问题描述】:
我想实现最简单的事情。即从 c# 控制台应用程序请求一个 aspx 页面,然后 aspx 页面应将一个字符串返回给 c# 应用程序。
我找了很多地方,但真的找不到任何东西:(
假设我的页面名为 www.example.com/default.aspx。从我的 C# 应用程序中,我向该页面发出请求,然后该页面应该只返回一个字符串“Hello”。
下面,我用伪代码写了我认为应该如何做。
C# 应用程序
public static void Main(string[] args)
{
//1. Make request to the page: www.example.com/default.aspx
//2. Get the string from that page.
//3. Write out the string. (Should be "Hello")
Console.ReadLine();
}
.aspx 代码
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string text = "Hello";
//1. Return the "text" variable to the client that requested this page
}
}
【问题讨论】:
-
看看这里,这是对类似问题的回答,但也适用于这里stackoverflow.com/questions/3892042/…
标签: c# asp.net request response