Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 4th, 2003, 03:58 PM
Curtis Curtis is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 7 Curtis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy My PostData command doesn't work

I want to automatically log a user onto our web site and enter their name and password for them. The VB6 code below will navigate to the website if I make the last line of this sample code as:
WB1.Navigate URL, flags, targetframe

Unfortunately, when I include the Postdata in the Navigate line it won't enter their username and password onto the website.
What am I doing wrong with the PostData command (or any other bad things I've done in the code)? Thanks for any help with this one.


Dim URL As String
Dim flags As Long
Dim targetframe As String
Dim PostData() As Byte
Dim headers As String
Dim cPW As String
Dim cname As String
Dim myPW As String
Dim myname As String
Dim cseparator As String * 1
cseparator = "&"
headers = "Content-Type: application/x-www-form-urlencoded" & vbCrLf
cname = "userID" 'website name of Name field
cPW = "password" 'website name of PW field
myname = "WA000003" ‘login name
myPW = "audit” ‘login password
URL = http://208.25.210.72/webagentaccessdemo/WebAgent.htm

PostData = cname & "=" & myname & cseparator & cPW & "=" & myPW
flags = 0
targetframe = ""
PostData = StrConv(PostData, vbFromUnicode)
WB1.Height = Me.ScaleHeight
WB1.Width = Me.ScaleWidth
WB1.Left = 0
WB1.Navigate URL, flags, targetframe, PostData, headers

Reply With Quote
  #2  
Old August 6th, 2003, 12:30 PM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 13 m 21 sec
Reputation Power: 76
What do you mean by "doesn't work"?? Does it give you an error or anything?

Reply With Quote
  #3  
Old August 6th, 2003, 01:46 PM
Curtis Curtis is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 7 Curtis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the quick response. I'm sorry but this is my first technical post and I forgot to give the error message.

In the last line of my code above, the Navigate command, if I remove everything after Targetframe, the browser successfully goes to the correct web site.
If I put back in , PostData, headers
at the end of the Navigate command, it gives me the screen:
This page cannot be displayed because the page address is incorrect.
HTTP 405 - resource not allowed.

Reply With Quote
  #4  
Old August 12th, 2003, 01:28 PM
Curtis Curtis is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 7 Curtis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Does anyone have a clue on this one? It sure seems like it should work OK, but it doesn't. Is there any alternative approach you'd suggest?

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > My PostData command doesn't work


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway