WebBrowser Control - Setting Referrer

I am writing a VB program to do some automated web processing.  I need to follow a link on a page, but I can't set it directly as  URL, as the target verifies the referring page.  You must click on the link on the main page for it to work, so the referrer property is set properly.

Is there a way to do this through the WebBrowser Object?
LVL 3
rmichelsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TheAnswerManCommented:
WebBrowser1.Navigate "http://www.yahoo.com"
0
TheAnswerManCommented:
are you saying that the web page you are on needs to be called from a previous page?   Maybe there is a cookie placed on your machine on the previous page.  

When you get the the second page.. copy the url and see if you can use the navigate feature....

If it will not work then you will need to go to the first page.. and after it loads up, then navigate to the second.
0
rmichelsAuthor Commented:
TheAnswerMan

The navigate function works fine. I already have that.  That does not answer my question.

The navigate command is the same as if you typed in an address on Internet Explorer.

There is a property on explorer that holds the refering page.  This gets set when you *click* on a link on the page.

Entering an address directly does not set the referring page.

What I'm looking for is a way to follow a link on a page, without using the navigate command for that link.  I use the Navigate method to get to the first page, then from there I need an alternate method to follow a link.

The target web page is checking the referring page, and it must be set or the navigate will get rejected by the target web page
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

crazymanCommented:
Along for the ride id like to know this too.
0
hesCommented:
Not sure how to but according to the documentation, in the following sub the referrer url should be available (therefore changed before the navigate2 event occures)

Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)

End Sub

Have used the Cancel and URL variables to change the contents and thus where the webbrowser goes to.
Try and add this to your project and set up a few dummy .htm to referrer to and see what variable contains the URL.
Might give you an idea which one to edit to add what you need.
0
clockwatcherCommented:
The header you want to add would be HTTP_REFERER--  note it's mispelled.  If that's actually what they're checking, they could just as easily be checking for a cookie, but either way the idea is the same (you need to add some additional header information)

The webbrowser control seems to automatically tack on the HTTP for the headers listed in its parameters-- so the following looks like it adds the proper header.

WebBrowser1.Navigate2 myUrl, , , , "REFERER: http://www.somewhere.com/somepage.htm" & vbCrLf
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.