社区
网络通信/分布式开发
帖子详情
下载论坛页面, 需要cookie认证, 请问怎样把cookie加进去?
snomile
2003-09-23 05:46:58
我想下载一个论坛的某页面,但是这个论坛要求必须先登录才能访问内部的页面, 我使用了TidHttp组件来下载页面,看它的help说应该与TidCookieManager配合使用。我的IE里面已经记录了这个论坛的cookie ,但是直接用TidHttp.Get来下载就是不行,请问哪位仁兄知道具体的操作过程? 最好能给出源代码,谢谢
...全文
269
7
打赏
收藏
下载论坛页面, 需要cookie认证, 请问怎样把cookie加进去?
我想下载一个论坛的某页面,但是这个论坛要求必须先登录才能访问内部的页面, 我使用了TidHttp组件来下载页面,看它的help说应该与TidCookieManager配合使用。我的IE里面已经记录了这个论坛的cookie ,但是直接用TidHttp.Get来下载就是不行,请问哪位仁兄知道具体的操作过程? 最好能给出源代码,谢谢
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
ptzld
2003-12-22
打赏
举报
回复
你下载一个IEcooiesview,再找一个cooie欺骗的教程,就可以了
aiirii
2003-12-22
打赏
举报
回复
繼續關注!
匪六哥
2003-12-22
打赏
举报
回复
搞了几天,终于有了点眉目,以下是我登录一个asp站点的delphi程序,使用了IDHttp控件和IDCookieManager控件,在delphi7(带indy9)+win2k pro调试通过。
有不当之处请指正,如转载请注明作者:yannqi。
1、网站asp程序:
判断如果有cookie显示用户名和邮件;如果没有将获得的用户名和邮件写入cookie。
<%
if (request.Cookies("name")="" or request.Cookies("email")="") then
Response.Cookies("name") = request("name")
Response.Cookies("email") = request("email")
Response.write(request("name")+","+request("email")+",写入cookie")
else
Response.write("Name:"+request.Cookies("name"))
Response.write("<br>email:"+request.Cookies("email"))
end if
%>
2、delphi form
object Form1: TForm1
Left = 258
Top = 154
Width = 650
Height = 388
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object btnLogin: TButton
Left = 256
Top = 24
Width = 75
Height = 25
Caption = '提交'
TabOrder = 0
OnClick = btnLoginClick
end
object edtUserName: TLabeledEdit
Left = 0
Top = 24
Width = 121
Height = 21
EditLabel.Width = 50
EditLabel.Height = 13
EditLabel.Caption = 'UserName'
TabOrder = 1
Text = 'yannqi'
end
object edtPassword: TLabeledEdit
Left = 128
Top = 24
Width = 121
Height = 21
EditLabel.Width = 25
EditLabel.Height = 13
EditLabel.Caption = 'Email'
TabOrder = 2
Text = 'xayahe@163.com'
end
object Memo1: TMemo
Left = 312
Top = 64
Width = 321
Height = 281
Lines.Strings = (
'Memo1')
TabOrder = 3
end
object Cookies: TMemo
Left = 8
Top = 64
Width = 297
Height = 281
Lines.Strings = (
'Cookies')
TabOrder = 4
end
object btnInfor: TButton
Left = 336
Top = 24
Width = 75
Height = 25
Caption = '测试'
TabOrder = 5
OnClick = btnInforClick
end
object Button3: TButton
Left = 416
Top = 24
Width = 43
Height = 25
Caption = '清空'
TabOrder = 6
OnClick = Button3Click
end
object http: TIdHTTP
MaxLineAction = maException
ReadTimeout = 0
AllowCookies = False
ProxyParams.BasicAuthentication = False
ProxyParams.ProxyPort = 0
Request.ContentLength = -1
Request.ContentRangeEnd = 0
Request.ContentRangeStart = 0
Request.ContentType = 'text/html'
Request.Accept = 'text/html, */*'
Request.BasicAuthentication = False
Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
HTTPOptions = [hoForceEncodeParams]
CookieManager = CookieMngr
Left = 120
Top = 96
end
object CookieMngr: TIdCookieManager
Left = 152
Top = 96
end
end
3、unit1。pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, IdCookieManager, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdHTTP;
type
TForm1 = class(TForm)
http: TIdHTTP;
CookieMngr: TIdCookieManager;
edtUserName: TLabeledEdit;
edtPassword: TLabeledEdit;
btnLogin: TButton;
Cookies: TMemo;
Memo1: TMemo;
btnInfor: TButton;
Button3: TButton;
procedure btnLoginClick(Sender: TObject);
procedure btnInforClick(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btnLoginClick(Sender: TObject);
var
s, s1: TStringStream;
i: Integer;
begin
s := TStringStream.Create('');
s1 := TStringStream.Create('');
try
s.WriteString('name=' + edtUserName.Text + '&');
s.WriteString('email=' + edtPassword.Text);
http.Request.ContentType := 'application/x-www-form-urlencoded';
try
http.Post('http://localhost/cookietest.asp', s, s1)
except
http.Get(http.Response.Location, s1);
end;
//}
Memo1.Lines.Text := s1.DataString;
//下面的是显示cookies信息的代码
Cookies.Clear;
Cookies.Lines.Add(inttostr(CookieMngr.CookieCollection.Count));
for i := 0 to CookieMngr.CookieCollection.Count - 1 do
Cookies.Lines.Add(CookieMngr.CookieCollection.Items[i].CookieText);
finally
s.Free;
s1.Free;
end;
end;
procedure TForm1.btnInforClick(Sender: TObject);
var
s, s1: TStringStream;
i: Integer;
begin
s := TStringStream.Create('');
s1 := TStringStream.Create('');
try
http.Request.ContentType := 'application/x-www';
http.AllowCookies:=true;
try
http.Post('http://localhost/cookietest.asp', s, s1)
except
http.Get(http.Response.Location, s1);
end;
Memo1.Lines.Text := s1.DataString;
Cookies.Clear;
for i := 0 to CookieMngr.CookieCollection.Count - 1 do
Cookies.Lines.Add(CookieMngr.CookieCollection.Items[i].CookieText);
finally
s.Free;
s1.Free;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
cookies.Clear;
Memo1.Clear;
end;
end.
aiirii
2003-12-19
打赏
举报
回复
關注
aiirii
2003-12-19
打赏
举报
回复
關注
匪六哥
2003-12-19
打赏
举报
回复
我也是这个问题
snomile
2003-09-24
打赏
举报
回复
小小up一下
详解在ASP.NET Core 中使用
Cookie
中间件
本篇文章主要介绍了详解在ASP.NET Core 中使用
Cookie
中间件,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
localhost
cookie
认证
失败,一直跳回登录
页面
?
问题描述 因为公司系统登录
页面
是单独的项目,所以每次登录之后(此时为 39.xxx)
需要
跳转到 localhost来进行开发,但是在经过几天愉快开发之后,localhost 登录不了了。 解决思路 首先排查前端问题是否获取到了
cookie
每次前端都获取到了一个新的
cookie
(后端认为你在重新登录了),即 localhost 一开始未获取到登录
页面
的
cookie
排查后端是否作了修改 询问之后并未作出修改 用 postman 测试后端登录是否好使 结果登录也好使,思路在这卡了很久
html中使用
cookie
做登录
页面
,(26)基于
cookie
的登陆
认证
(写入
cookie
,登陆后所有域下的网页都可访问、登陆成功跳转至用户开始访问的
页面
,使用装饰器完成所有
页面
的登陆
认证
,)...
当一个网站没有登录的时候,用户点击后台会跳转到登录
页面
,程序登录后自动跳转至用户开始访问的
页面
,具体做法看下面的案例views.pyfrom django.shortcuts import render,HttpResponse,redirectfrom app01 import models'''写一个
cookie
版的登陆'''def login_auth(func):'''这个装饰器给cook...
html 重定向 设置
cookie
,【已解决】如何获得网页重定向过程中的
cookie
信息
【问题】用C#代码实现访问一个网页,但是其中该网页会重定向到另外一个地址。而在重定向之前,根据分析工具分析而得之,会返回对应的
cookie
信息,此处包含了登陆
认证
相关的
cookie
信息。所以此处
需要
获得此信息用于后来继续访问相关网页。但是由于网页重定向了,所以所得到的响应的头部中的
cookie
信息,已经没了对应的
认证
信息,所以,想要想办法去获得,在网页重定向的过程中,那些对应的
cookie
信息。【...
页面
iframe嵌入其它域
页面
cookie
失效问题
遇到统一
认证
(集中
认证
),A平台很有可能
需要
在现有
页面
上嵌入其它平台的登录
页面
,由于
需要
单点,负责集中
认证
的B平台会写
cookie
,在ie7,ie6访问时,A平台嵌入的B平台
页面
,有可能会出现
cookie
失效(读不到)的情况,查询资料得到解决方案如下: response.addHeader("P3P","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD I...
网络通信/分布式开发
1,594
社区成员
32,947
社区内容
发帖
与我相关
我的任务
网络通信/分布式开发
Delphi 网络通信/分布式开发
复制链接
扫一扫
分享
社区描述
Delphi 网络通信/分布式开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章