473,385 Members | 1,396 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,385 software developers and data experts.

How to get this cookie value when I am browsing a website??

Hello, all experts:

May I ask you some questions? First, i'm programming a software of
auto-authentication by using VB.NET tool. This software's functions is
similar to do the account login through browser. I meet some questions when
I post data to authentication page. I have tested the authentication
webpages of Gemtek G-6000 and Cipherium bonalinx-W 1300 separately.
Authentication succeeds for Gemtek, unsuccessful for Cipherium. I think that
the reasons should be cookie's problem. I can get the cookie value browsing
the auth-page of Gemtek, but Cipherium's not. Its headers resopnse message
is as follows:

Date: Tue, 06 Jan 1970 00:54:00 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.2 mod_ssl/2.8.16 OpenSSL/0.9.7c
X-Powered-By: PHP/4.3.2
Location: error_user.shtml?uname=chen&msg=Can not read data from
Cookie,Please check your browser.
Transfer-Encoding: chunked
Content-Type: text/html

I am unable to fetch the cookie value, so unable to post authentication data
to Cipherium gateway. I don't know why this is? Why one is right but another
is not right? Who can help me to check my code and tell me this where is the
Crux??

List my code as following:

----------------------------------------------------------------------------------------------------
objWebRequest = CType(WebRequest.Create(dURL), HttpWebRequest)
objWebRequest.CookieContainer = New System.Net.CookieContainer

objWebRequest.AllowAutoRedirect = False
objWebRequest.Method = "POST"
objWebRequest.ContentType = "application/x-www-form-urlencoded"

'----------------------------------
' Cookie
'----------------------------------

objWebRequest.ContentLength = postData.Length
objWebRequest.AllowWriteStreamBuffering = False

Dim myWriter As StreamWriter = New
StreamWriter(objWebRequest.GetRequestStream())
myWriter.Write(postData)
myWriter.Close()

'---------------
' Send the Data
'---------------

objWebResponse = CType(objWebRequest.GetResponse(),
HttpWebResponse)
Console.WriteLine(ControlChars.Cr + "{0}",
objWebRequest.RequestUri)

objWebResponse.Cookies =
objWebRequest.CookieContainer.GetCookies(objWebReq uest.RequestUri)

Dim cook As System.Net.Cookie

For Each cook In objWebResponse.Cookies

Console.WriteLine("Cookie:")
Console.WriteLine("{0} = {1}", cook.Name, cook.Value)
Console.WriteLine("Domain: {0}", cook.Domain)
Console.WriteLine("Path: {0}", cook.Path)
Console.WriteLine("Port: {0}", cook.Port)
Console.WriteLine("Secure: {0}", cook.Secure)
Console.WriteLine("When issued: {0}", cook.TimeStamp)
Console.WriteLine("Expires: {0} (expired? {1})",
cook.Expires, cook.Expired)
Console.WriteLine("Don't save: {0}", cook.Discard)
Console.WriteLine("Comment: {0}", cook.Comment)
Console.WriteLine("Uri for comments: {0}", cook.CommentUri)
Console.WriteLine("Version: RFC {0}", IIf(cook.Version = 1,
"2109", "2965"))
Console.WriteLine("String: {0}", cook.ToString())

Next cook

Console.WriteLine(ControlChars.Cr + "{0}",
objWebResponse.Headers.ToString)
---------------------------------------------------------------------------------------------------------------

thanks and regards,
~Kevin
Nov 21 '05 #1
0 1215

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jiangcheng.bao | last post by:
We have a webpage, which pops up a new window, prompting logged-in user to upload images. This works completely fine with regular internet explorer because we use cookie to verify if users are...
1
by: Rahul Chatterjee | last post by:
Hello All I have an asp page problem (the nature is slightly complex so please bear with the long winded explanation). We have a sandbox front end domain and a sandbox backend domain. The...
0
by: JavaDoc | last post by:
Not sure I've posted this in the right place but here's the problem. I've made some progress but I'm stuck. I can find and use the data in a required cookie and send it in the httprequest as...
0
by: obhayes | last post by:
Hi All, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
1
by: brad | last post by:
Hi, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
29
by: Jerim79 | last post by:
I did try to find the answer to this before posting, so this isn't a knee jerk reaction. What I am trying to accomplish is to have a script that opens a cookie, reads a value, and then use a...
1
by: marc heiners | last post by:
Hello! I have to overgive an information from one website to another (same domain) by sertting a cookie with javascript. When the website is requested by a user a session cookie with a default...
3
by: webster5u | last post by:
Miss/Mr. Programmer, I have a idea to remove the cookie value from a website after all browser closed. It is like session kept in server and eliminate after all browser closed. My purpose is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.