Solved

Simple Question about InternetGetCookie

Posted on 2002-04-09
13
1,326 Views
Last Modified: 2007-11-27
For reading a cookie I found the following code on the internet:
   Dim strCookieText As String * 256
   Dim blnReturn As Boolean
   blnReturn = InternetGetCookie("http://xxxx/xxx.htm", _
                  "CookieName", strCookieText, 255)
   If Not blnReturn Then
     MsgBox "Get Cookie Operation Failed", vbCritical
   Else
     MsgBox strCookieText, vbInformation
   End If

I am trying to read a cookie which is written by an asp page (which happens to be our login page). I want to read the cookie by a Visual Basic app which is on the client site. What I fail to understand is what is the first parameter to the InternetGetCookie. How do I read the cookie by a VB app.
0
Comment
Question by:sachinkas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
  • +1
13 Comments
 
LVL 5

Expert Comment

by:rkot2000
ID: 6929607
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6929610
full sample from microsoft :



HOWTO: Set and Get Cookies for a URL Using WinInet APIs (Q196062)
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q196062
0
 
LVL 1

Author Comment

by:sachinkas
ID: 6929686
Yeah I have tried that in fact thats the code I have put. My question is what to put in the first parameter. I have tried that code, but get an error.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 28

Expert Comment

by:vinnyd79
ID: 6930015
The first parameter is url name,followed by cookie name and cookie data.What error are you getting?
0
 

Expert Comment

by:vinky_j
ID: 6930842
I think there must be error in reading from the source file.Did u given the proper path in this?
0
 
LVL 1

Author Comment

by:sachinkas
ID: 6931469
The question is what proper path I should give. This is going to be a VB app which is installed on the clients machine. The way it works is this:
User logs in through an ASP page which writes the cookies.
Now the VB app should read the cookies.
Now you guys tell me what url or proper path I should give.
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6931503
The url should be the same url that was written by your asp page.
0
 
LVL 1

Author Comment

by:sachinkas
ID: 6931563
The problem is this url is always going to be different. There are different ways a user can login. I know that it writes the cookies in the profiles folder with a name similar to: <nt userid>@<domain>[2].txt
For e.g. emp001@abc123[2].txt
where emp001=nt userid of the user
abc123= the domain name. e.g. abc123.com
So maybe one way I could do this is try to somehow read this file and then read the cookie information.
But this is going to be real long. Isn't there some way in which if I know the domain name (abc123), it will return me the required cookie information.

Does anybody know how the Wininet api searches the cookie information. How does it know that THIS cookie file is mapped to THIS url.
Thanx.
0
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 50 total points
ID: 6931599
Maybe this example will help.

http://www.karenware.com/powertools/ptcookie.asp
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6931616
may be you can try this :

' If CookieName is omitted, returns all the cookies as
' as semicolon-delimited list of NAME=VALUE pairs

http://www.vb2themax.com/Item.asp?PageID=CodeBank&ID=262

0
 
LVL 1

Author Comment

by:sachinkas
ID: 6931942
Superb Vinnyd79
I think you deserve the points.
How did you get this link. Good!!!
0
 
LVL 1

Author Comment

by:sachinkas
ID: 6931944
Superb Vinnyd79
I think you deserve the points.
How did you get this link. Good!!!
0
 
LVL 1

Author Comment

by:sachinkas
ID: 6984178
Guys I am deleting this question. Thanx for ur time
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month4 days, 17 hours left to enroll

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question