|
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.
|
|
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) {
}
|
|
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.aspxThanks!
|
|
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!!
|
|
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!
|
|