Welcome Guest Search | Active Topics | Sign In | Register

Why ResourceHandler Request Cookie always empty Options
Gray
Posted: Thursday, October 4, 2018 4:41:08 PM
Rank: Newbie
Groups: Member

Joined: 10/4/2018
Posts: 3
When I ProcessRequest I add cookie to Response, but next Request Cookie is empty.
And ResourceHandler ProcessReqeust won't get the cookie generated by javascript.
Gray
Posted: Thursday, October 4, 2018 4:58:49 PM
Rank: Newbie
Groups: Member

Joined: 10/4/2018
Posts: 3
How can I get Browser cookies?
When I load completed web, Cookies has append to Browser, But request cookies is alway empty.

public override bool Match(Request request) {
return request.Url.EndsWith("Request");
}

public override void ProcessRequest(Request request, Response response) {

}
eo_support
Posted: Thursday, October 4, 2018 5:33:56 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

I am not exactly sure what you are trying to do. Can you create a test project that demonstrates the problem and send it to us? See here for more details:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
Gray
Posted: Thursday, October 4, 2018 11:21:35 PM
Rank: Newbie
Groups: Member

Joined: 10/4/2018
Posts: 3
Suppose I first login to a website,
the website gives me a cookie,
so that I can use it to query the member information,
but I match the URL of the member information page,
[ProceeRequest] can't give me the cookie I just got after logging in,
[ProceeRequest] can't give me the cookie to use [httpRequest] to crawler data.
and if I query the member information,
The website gave me a new cookie,
how to add it to EoWebBrowser?
because web use javascript(document.cookie) to read new cookie.

public override bool Match(ResourceHandlerContext context) {
return context.Request.Url.EndsWith("accountInfo.php");
}
public override void ProcessRequest(Request request, Response response) {
// ***** I can't get web cookie from reuqest.Cookie, use to httpWebReuqest ****
// Create a request for the URL.
WebRequest httpRequest = WebRequest.Create(request.Url);
// Get the response.
using (HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse()) {
// Get the stream containing content returned by the server.
using (Stream dataStream = httpResponse.GetResponseStream()) {
dataStream.CopyTo(response.OutputStream);
}
}
}

I has send TestProject to email, Thanks!!
eo_support
Posted: Friday, October 5, 2018 3:18:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

Thanks for the test project. We have looked into this issue. The reason that it does not work is because once you use custom resource loader, everything is bypassed --- including the cookie mechanism.

It is possible for you to monitor all cookies the WebView has received through WebView.AfterReceiveHeaders event. This way you can store the cookies of interest in your own mechanism and then attach it to your request in your custom resource handler.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.