0

I am developing a windows forms application, in this application I am controlling a website.

The website has a login button which when clicked takes the user to a second page containing a link.

I would like my application to navigate through the login button page (effectively clicking the login button) and then have it click the link on the second page.

How do I do this?

Kev
  • 118,037
  • 53
  • 300
  • 385
Prachur
  • 1,100
  • 7
  • 24
  • 42
  • How are you controlling the website? If you're sending requests to it, then it's just a case of requesting the url that the link you're interested in goes to. If you're controlling it in another window, you can send a mouse event... what exactly are you looking for / have you already done? – forsvarir Apr 01 '11 at 13:32
  • possible duplicate of [Perform a click on a Webbrowser control.](http://stackoverflow.com/questions/5493276/perform-a-click-on-a-webbrowser-control) – Hans Passant Apr 01 '11 at 13:35
  • i am using webbrowser control to control the site. i want to login in the website & programmatically click the link on website which comes on the first page after login by click of a single button – Prachur Apr 01 '11 at 13:38

2 Answers2

0

this should work.

webbrowser.Document.All["ID OF ELEMENT (I THINK NAME WORKS TOO)"].InvokeMember("click");

but yeah, also -- this is a duplicate question.

Joshua Evensen
  • 1,544
  • 1
  • 15
  • 33
  • where should i use it, i am facing a different issue. in the event hadler of login button firstly login is taking place and in same i want to click the link , but this is giving exception – Prachur Apr 01 '11 at 14:02
0

Why not pass something through the query string from the login page to the first page. Then check if it contains the "login" page query string. If it does...redirect to your second page. If it doesn't then keep the person on the page.

Just do something simple like this to check

if (!String.IsNullOrEmpty(Page.Request["yourquerystring"]))
        {
             Response.Redirect("Yoursecondlink");
        }
bvandrunen
  • 443
  • 1
  • 6
  • 15