最後一次我必須解決類似的情況,我使用標準的ASPX頁面來完成,而且這一切都工作得很好。
在我的情況下輸出是XML,所以我必須確保我改變了輸出MIME類型以匹配「text/xml」在我的情況下..「text/plain」我猜你在..
不管怎樣,下面的C#代碼尖銳,並確保您的ASPX文件只有在極頂線,那就是:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="register.aspx.cs" Inherits="myservices.register" ContentType="text/xml" %>
,沒有別的,沒有回車或任何東西。
然後做所有的工作在後面的代碼:
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "text/plain";
//Get your CGI variables here... you will have to get them to tell you what to expect
string myparam = (string)Request.QueryString["myparam"];
//do what ever you need here with your variables
Response.Write("1");
Response.End();
}// End page load handler
如果您需要按照以回車的一個,那麼我相信你可以在統環境物體使用回車財產,但我沒有收到文檔來查找它。但是,這應該讓你開始。
要記住的最重要的事情是確保NOTHING是從aspx輸出的,甚至不是回車。
我以前在我的博客上寫過一篇關於如何使用此方法爲Cisco-IP電話製作電話號碼簿的文章,如果您想閱讀它。你可以在這裏找到它:http://shawtyds.wordpress.com/2009/09/26/cisco-ip-phone-directories-using-c/
通過獲取http POST vars獲取數據;至於返回1,我會想象返回它就像Response.Write(「1」)一樣簡單; – Dave