473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to retrievie cookie from webpage

3
I'm currently writing a C# program to login into a particular website. As for debugging purposes, i installed Firebug for Firefox. However i have some problems in generating one particular cookie ("FW_Session") which is necessary for logging in.

using Firebug, i noticed that this particular cookie will be generated once i logged in successfully into the website. Only after logging in, then i can use the generated cookie in my httpwebrequest to login programatically. However this cookie will be expired after 1 day.

Is there any method that i can get the correct cookie so that i can login programatically?
May 25 '10 #1
5 1447
Plater
7,872 Expert 4TB
Your first httpwebrequest to the website should generate the session id (it probably won't be in your cookie container on the object, have to check params)
May 25 '10 #2
akai80
3
Hi thxs for the advice. Pardon me but how do I retrieve parameters from the webresponse? Currently im able to retrieve cookies from the webresponse.

Previously I have tested in my codes to login without the session cookie but I'm unable to do so. What I suspect is that I will need to have the correct session cookie and post it back to the web page together with the login username and password. Pls correct me if I'm wrong.

Thank You
May 26 '10 #3
Plater
7,872 Expert 4TB
I think Params was the wrong word.
Check the contents of the .Headers property for the instance of "FW_Session"
May 26 '10 #4
akai80
3
Hi

thxs for your prompt reply. I have checked through the headers and i copied it as follows:

{Connection: close
Date: Wed, 26 May 2010 17:00:47 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Type: text/html
Cache-Control: private
Set-Cookie: MyStamp=628669196; expires=Wednesday, 26-May-2010 17:30:47 GMT,MyId=ANDY__PS__27_05_10_01_30_47; expires=Wednesday, 26-May-2010 17:30:47 GMT,cSessUserId=ANDY
Expires: Sunday, 31-Dec-1989 16:00:00 GMT
}

However the particular session parameter which i need is not embedded inside the header section. Actually i do not see this in any portion of the httpwebresponse. Any other ideas to get it?

Thank You
May 26 '10 #5
Plater
7,872 Expert 4TB
Interesting. Have you tried using an actual packet watcher software to follow the communication between a browser and the server?
Myabe you're missing a hidden step in your code.
May 26 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Vikram Bhatia | last post by:
In my web application we are able to store large data in the browser cookie keeping in mind the limit of 300 cookies per cookie file, 20 keys per cookie per domain and 4KB max size of each cookie....
3
by: F | last post by:
It seems that document.cookie doesn't work both on Internet Explorer 5 for Mac (OS 9) and Opera 6 for PC... am I doing something wrong? Or does it just not work? I don't get an error message, the...
3
by: Justin Morris via DotNetMonster.com | last post by:
<asp:TextBox ID="TextBox1" runat="server" value='<%=Server.HtmlEncode (Request.Cookies("Username")("Username"))%>'/> <input name="Password" type="text" id="Password" value='<%...
1
by: SamG | last post by:
Hello, Does anyone know how I can Write a Cookie and then later retrieve it...? Also, Is it possible to write attributes and corresponding values to the cookie file.Needless to say would require...
4
by: me | last post by:
Hi all, Can anyone give me any pointers on how to do the following in VB.NET? Basically, I want a procedure that will take a web URL and a string as parameters, e.g. www.microsoft.com and...
17
by: Bruno | last post by:
I have a feature that is hosted on a different domain from the primary one in a frame, and need to retain values in a cookie. example: A web page at one.com contains a frame which has a page...
9
by: duzhidian | last post by:
Hello: There are a couple techniques to move information from different html web page to web page. 1. URL; 2. Cookie; 3. Form; 4. Session; All the examples I found are move distinguished...
2
by: teddarr | last post by:
I want to write a cookie that will hold purchase information. The name of this cookie will be a julian date/time. How do I go about retrieving all the cookies within a certain time period? ...
2
by: miraan | last post by:
Hi, I set a php cookie on one page, is it possible to retrieve the same cookie on another webpage on my site or can i just retrieve the cookie from the page that i set the cookie on?
2
by: SV | last post by:
I have a login form with “Remember me on this computer” checkbox. I am creating cookie if checkbox is checked. My code is: If chk_remember.Checked = True Then Dim ckUserName As HttpCookie =...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.