How do I navigate a website programmatically from a windows forms application?
I am developing a windows forms application, in this application I am controlling a website.
The website has a login button开发者_Go百科 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?
this should work.
webbrowser.Document.All["ID OF ELEMENT (I THINK NAME WORKS TOO)"].InvokeMember("click");
but yeah, also -- this is a duplicate question.
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");
}
精彩评论