[C#][UWP] How to get full Cookiess of website HTTPS










1















I'm trying to get cookies of forum: https://forums.voz.vn/ with my Chrome browser.



I have 6 cookie values:



  1. vfimloggedin.

  2. vflastactivity.

  3. vflastvisit.

  4. vfpassword.

  5. vfsessionhash

  6. vfuserid.

Image



When I use code below:



string postData = "&vb_login_username="
+ user
+ "&vb_login_password="
+ password
+ "&cookieuser=checked"
+ "&do=login"
+ "&s="
+ "securitytoken=guest"
+ "&vb_login_md5password="
+ "&vb_login_md5password_utf=&";
string applicationEncoded = "application/x-www-form-urlencoded";

try

HttpClient client = new HttpClient(handler);
client.DefaultRequestHeaders.Add(Resource.USER_AGENT, Resource.USER_AGENT_VALUE);

using (HttpResponseMessage response = client.PostAsync(loginUrl, new StringContent(postData, Encoding.UTF8, applicationEncoded)).Result)

using (HttpResponseMessage responseMessage = client.GetAsync("https://forums.voz.vn/").Result)

using (HttpContent content = responseMessage.Content)

contentHtml = content.ReadAsStringAsync().Result;

IEnumerable<Cookie> responseCookies = cookies.GetCookies(new Uri("https://forums.voz.vn/")).Cast<Cookie>();
foreach (Cookie cookie in responseCookies)

if (cookie.Name == Resource.COOKIES_NAME)

appSetting.Cookies = cookie.Value;
break;






catch (Exception ex)

contentHtml = Resource.STR_ERROR;



I saw 4 cookies values:



  1. vfimloggedin.

  2. vflastactivity.

  3. vflastvisit.

  4. vfsessionhash

Image



How can I retrieve all cookies for this forum?



Thanks!










share|improve this question
























  • Did u know when these cookies are saved? I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored. I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer.

    – Bite
    Nov 16 '18 at 8:52











  • --- I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored-- -> Thank for suggested, i'll try this. --- I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer--- I dont think that, because when im add vfsessionhash cookies to HttpClient, html response have infomation of this account.

    – nvcuong1312
    Nov 16 '18 at 15:19











  • Thank you!!!!! There was an error in my submit form. I checked with the fiddler and discovered it.

    – nvcuong1312
    Nov 17 '18 at 3:47















1















I'm trying to get cookies of forum: https://forums.voz.vn/ with my Chrome browser.



I have 6 cookie values:



  1. vfimloggedin.

  2. vflastactivity.

  3. vflastvisit.

  4. vfpassword.

  5. vfsessionhash

  6. vfuserid.

Image



When I use code below:



string postData = "&vb_login_username="
+ user
+ "&vb_login_password="
+ password
+ "&cookieuser=checked"
+ "&do=login"
+ "&s="
+ "securitytoken=guest"
+ "&vb_login_md5password="
+ "&vb_login_md5password_utf=&";
string applicationEncoded = "application/x-www-form-urlencoded";

try

HttpClient client = new HttpClient(handler);
client.DefaultRequestHeaders.Add(Resource.USER_AGENT, Resource.USER_AGENT_VALUE);

using (HttpResponseMessage response = client.PostAsync(loginUrl, new StringContent(postData, Encoding.UTF8, applicationEncoded)).Result)

using (HttpResponseMessage responseMessage = client.GetAsync("https://forums.voz.vn/").Result)

using (HttpContent content = responseMessage.Content)

contentHtml = content.ReadAsStringAsync().Result;

IEnumerable<Cookie> responseCookies = cookies.GetCookies(new Uri("https://forums.voz.vn/")).Cast<Cookie>();
foreach (Cookie cookie in responseCookies)

if (cookie.Name == Resource.COOKIES_NAME)

appSetting.Cookies = cookie.Value;
break;






catch (Exception ex)

contentHtml = Resource.STR_ERROR;



I saw 4 cookies values:



  1. vfimloggedin.

  2. vflastactivity.

  3. vflastvisit.

  4. vfsessionhash

Image



How can I retrieve all cookies for this forum?



Thanks!










share|improve this question
























  • Did u know when these cookies are saved? I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored. I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer.

    – Bite
    Nov 16 '18 at 8:52











  • --- I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored-- -> Thank for suggested, i'll try this. --- I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer--- I dont think that, because when im add vfsessionhash cookies to HttpClient, html response have infomation of this account.

    – nvcuong1312
    Nov 16 '18 at 15:19











  • Thank you!!!!! There was an error in my submit form. I checked with the fiddler and discovered it.

    – nvcuong1312
    Nov 17 '18 at 3:47













1












1








1








I'm trying to get cookies of forum: https://forums.voz.vn/ with my Chrome browser.



I have 6 cookie values:



  1. vfimloggedin.

  2. vflastactivity.

  3. vflastvisit.

  4. vfpassword.

  5. vfsessionhash

  6. vfuserid.

Image



When I use code below:



string postData = "&vb_login_username="
+ user
+ "&vb_login_password="
+ password
+ "&cookieuser=checked"
+ "&do=login"
+ "&s="
+ "securitytoken=guest"
+ "&vb_login_md5password="
+ "&vb_login_md5password_utf=&";
string applicationEncoded = "application/x-www-form-urlencoded";

try

HttpClient client = new HttpClient(handler);
client.DefaultRequestHeaders.Add(Resource.USER_AGENT, Resource.USER_AGENT_VALUE);

using (HttpResponseMessage response = client.PostAsync(loginUrl, new StringContent(postData, Encoding.UTF8, applicationEncoded)).Result)

using (HttpResponseMessage responseMessage = client.GetAsync("https://forums.voz.vn/").Result)

using (HttpContent content = responseMessage.Content)

contentHtml = content.ReadAsStringAsync().Result;

IEnumerable<Cookie> responseCookies = cookies.GetCookies(new Uri("https://forums.voz.vn/")).Cast<Cookie>();
foreach (Cookie cookie in responseCookies)

if (cookie.Name == Resource.COOKIES_NAME)

appSetting.Cookies = cookie.Value;
break;






catch (Exception ex)

contentHtml = Resource.STR_ERROR;



I saw 4 cookies values:



  1. vfimloggedin.

  2. vflastactivity.

  3. vflastvisit.

  4. vfsessionhash

Image



How can I retrieve all cookies for this forum?



Thanks!










share|improve this question
















I'm trying to get cookies of forum: https://forums.voz.vn/ with my Chrome browser.



I have 6 cookie values:



  1. vfimloggedin.

  2. vflastactivity.

  3. vflastvisit.

  4. vfpassword.

  5. vfsessionhash

  6. vfuserid.

Image



When I use code below:



string postData = "&vb_login_username="
+ user
+ "&vb_login_password="
+ password
+ "&cookieuser=checked"
+ "&do=login"
+ "&s="
+ "securitytoken=guest"
+ "&vb_login_md5password="
+ "&vb_login_md5password_utf=&";
string applicationEncoded = "application/x-www-form-urlencoded";

try

HttpClient client = new HttpClient(handler);
client.DefaultRequestHeaders.Add(Resource.USER_AGENT, Resource.USER_AGENT_VALUE);

using (HttpResponseMessage response = client.PostAsync(loginUrl, new StringContent(postData, Encoding.UTF8, applicationEncoded)).Result)

using (HttpResponseMessage responseMessage = client.GetAsync("https://forums.voz.vn/").Result)

using (HttpContent content = responseMessage.Content)

contentHtml = content.ReadAsStringAsync().Result;

IEnumerable<Cookie> responseCookies = cookies.GetCookies(new Uri("https://forums.voz.vn/")).Cast<Cookie>();
foreach (Cookie cookie in responseCookies)

if (cookie.Name == Resource.COOKIES_NAME)

appSetting.Cookies = cookie.Value;
break;






catch (Exception ex)

contentHtml = Resource.STR_ERROR;



I saw 4 cookies values:



  1. vfimloggedin.

  2. vflastactivity.

  3. vflastvisit.

  4. vfsessionhash

Image



How can I retrieve all cookies for this forum?



Thanks!







uwp dotnet-httpclient






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 17:37









Lee Mac

4,83431542




4,83431542










asked Nov 15 '18 at 17:23









nvcuong1312nvcuong1312

63




63












  • Did u know when these cookies are saved? I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored. I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer.

    – Bite
    Nov 16 '18 at 8:52











  • --- I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored-- -> Thank for suggested, i'll try this. --- I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer--- I dont think that, because when im add vfsessionhash cookies to HttpClient, html response have infomation of this account.

    – nvcuong1312
    Nov 16 '18 at 15:19











  • Thank you!!!!! There was an error in my submit form. I checked with the fiddler and discovered it.

    – nvcuong1312
    Nov 17 '18 at 3:47

















  • Did u know when these cookies are saved? I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored. I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer.

    – Bite
    Nov 16 '18 at 8:52











  • --- I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored-- -> Thank for suggested, i'll try this. --- I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer--- I dont think that, because when im add vfsessionhash cookies to HttpClient, html response have infomation of this account.

    – nvcuong1312
    Nov 16 '18 at 15:19











  • Thank you!!!!! There was an error in my submit form. I checked with the fiddler and discovered it.

    – nvcuong1312
    Nov 17 '18 at 3:47
















Did u know when these cookies are saved? I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored. I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer.

– Bite
Nov 16 '18 at 8:52





Did u know when these cookies are saved? I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored. I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer.

– Bite
Nov 16 '18 at 8:52













--- I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored-- -> Thank for suggested, i'll try this. --- I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer--- I dont think that, because when im add vfsessionhash cookies to HttpClient, html response have infomation of this account.

– nvcuong1312
Nov 16 '18 at 15:19





--- I suggested that you first use fiddler to simulate HTTP post request and to see when and which cookie is stored-- -> Thank for suggested, i'll try this. --- I guessed your 'Login' HTPP POST request failed, then the remaining two cookies are not sent from server to your computer--- I dont think that, because when im add vfsessionhash cookies to HttpClient, html response have infomation of this account.

– nvcuong1312
Nov 16 '18 at 15:19













Thank you!!!!! There was an error in my submit form. I checked with the fiddler and discovered it.

– nvcuong1312
Nov 17 '18 at 3:47





Thank you!!!!! There was an error in my submit form. I checked with the fiddler and discovered it.

– nvcuong1312
Nov 17 '18 at 3:47












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324857%2fcuwp-how-to-get-full-cookiess-of-website-https%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324857%2fcuwp-how-to-get-full-cookiess-of-website-https%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

政党