开发者

how to answer on GET request in asp.net

I have a problem and I would really appreciate your help.

An external application is sending via GET some parameters on address of my asp.net page. (something like http://mypage.com/default.aspx?id=123). I read this parameter on page load and do some other things.

If I receive the parameter correctly I must answer immediately the external application (the same which send me the parameter) with plain text 'OK'.

How to do this reply with c# asp.net ? Any sample code ? Thanks in advance for help.

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Page开发者_开发百科.Request.QueryString["id"];
        if (!String.IsNullOrEmpty(id))
        {
            SendAnswer();
        }
    }

    private void SendAnswer()
    {
        // ??????? send simple reply 'OK' as plain text
    }
}


You can send anything you want with Response.Write. You might have to do Response.Clear first.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜