[英]ISAPI webbroker requestcontentfields is empty (length = 0)
我使用向導創建了一個WebBroker應用程序。 我更改了默認操作的代碼,因此如下所示:
procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
i: Integer;
begin
i := Request.ContentLength;
Response.Content :=
'<html>' +
'<head><title>DataSnap Server</title></head>' +
'<body>DataSnap Server x' +
Request.ContentFields.Text + 'x' + IntToStr(i) + 'x' +
'</body>' +
'</html>';
end;
我將dll部署在IIS(6.2-Server 2012)下,並使用Web瀏覽器測試了該dll。
http://localhost/MapServer/Mapserver.dll/?param1 = hello
我只是嘗試了一下
http://localhost/MapServer/Mapserver.dll/?param1 = “ hello”
瀏覽器輸出
DataSnap服務器xx0x
在兩種情況下。
似乎Request.ContentFields
未被瀏覽器的調用填充。
此問題是否特定於特定版本的Delphi和/或IIS? 我不明白什么?
我已經試過西雅圖和柏林,結果是一樣的。 謝謝
PS我還使用向導制作了一個獨立的WebBroker。 它沒有這個問題。
在Google進行了非常深入的搜索之后,我找到了答案:(請注意,盡管Embarcadero文檔指出Request.ContentFields
包含“當MethodType為mtPost時”字段的內容,但對Request.QueryFields
幾乎沒有用的文檔卻沒有mtGet
)
procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
i: Integer;
begin
i := Length(Request.QueryFields.Text);
Response.Content :=
'<html>' +
'<head><title>DataSnap Server</title></head>' +
'<body>DataSnap Server x' +
Request.QueryFields.Text + 'x' + IntToStr(i) + 'x' +
'</body>' +
'</html>';
end;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.