3
3h
Unregistered / Unconfirmed
GUEST, unregistred user!
先看一段代码,是ISAPI里存取Cookies的:
procedure TWebModule1.SetCookies(Var UInfo: TUserInfo);
Var
Cookies: TStringList;
begin
Cookies := TStringList.Create;
Try
With Cookies, UInfo do
begin
Add('UserName=' + UserName);
Add('UserID=' + IntToStr(UserID));
end;
UInfo.PResponse^.SetCookieField(Cookies, '127.0.0.1', '/', Now+0.0035, False);
Finally
Cookies.Free;
end;
end;
这部分工作正常,得到的COOKIES内容也对(从COOKIES文件夹里看到的)。
立即执行:
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
Var
CookiesList: TStringList;
s:string;
i:integer;
begin
CookiesList := TStringList.Create;
Request.ExtractCookieFields(CookiesList);
for i:=0 to cookieslist.Count-1 do
s:=s+ CookiesList
response.Content := s;
cookieslist.Free;
end;
总得到空值,为什么?难道取COOKIES是另有它法???
procedure TWebModule1.SetCookies(Var UInfo: TUserInfo);
Var
Cookies: TStringList;
begin
Cookies := TStringList.Create;
Try
With Cookies, UInfo do
begin
Add('UserName=' + UserName);
Add('UserID=' + IntToStr(UserID));
end;
UInfo.PResponse^.SetCookieField(Cookies, '127.0.0.1', '/', Now+0.0035, False);
Finally
Cookies.Free;
end;
end;
这部分工作正常,得到的COOKIES内容也对(从COOKIES文件夹里看到的)。
立即执行:
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
Var
CookiesList: TStringList;
s:string;
i:integer;
begin
CookiesList := TStringList.Create;
Request.ExtractCookieFields(CookiesList);
for i:=0 to cookieslist.Count-1 do
s:=s+ CookiesList
response.Content := s;
cookieslist.Free;
end;
总得到空值,为什么?难道取COOKIES是另有它法???