Hi. I am trying to make a simple C# WinForms app to get some data from a web site. It all works well until i got to a site where i can not directly go to the page i want. So, when i request the url (whether in C# or in a browser) i get redirected to a disclaimer page where i should click "I accept" to get in. And once i do, it doesn't redirect me to the url i previously entered, but the home page instead. So, i am looking for a way to press the button in code and go to the proper page all day long with no luck. And yes... i did google for an answer, but somehow i can't make heads or tails out of it. I know how to do POST with HttpWebRequest, but i guess i am missing something.
Here is the page i want to get:
http://pdonline.brisbane.qld.gov.au/masterview/modules/applicationmaster/default.aspx?page=wrapper&key=A001617250
When i point to that url, i get his one:
http://pdonline.brisbane.qld.gov.au/masterview/masterplan/enquirer/default.aspx?page=disclaimer
where "I accept" button is.
Thanks for any help in advance. Please let me know if you need more details.
Cheers
7 3062
Hi. I am trying to make a simple C# WinForms app to get some data from a web site. It all works well until i got to a site where i can not directly go to the page i want. So, when i request the url (whether in C# or in a browser) i get redirected to a disclaimer page where i should click "I accept" to get in. And once i do, it doesn't redirect me to the url i previously entered, but the home page instead. So, i am looking for a way to press the button in code and go to the proper page all day long with no luck. And yes... i did google for an answer, but somehow i can't make heads or tails out of it. I know how to do POST with HttpWebRequest, but i guess i am missing something.
Here is the page i want to get:
http://pdonline.brisbane.qld.gov.au/masterview/modules/applicationmaster/default.aspx?page=wrapper&key=A001617250
When i point to that url, i get his one:
http://pdonline.brisbane.qld.gov.au/masterview/masterplan/enquirer/default.aspx?page=disclaimer
where "I accept" button is.
Thanks for any help in advance. Please let me know if you need more details.
Cheers
Hello fellow Queenslander!
This is a dodgy work around, mate... but dodgy is better than nothin'.
You could loop through the controls, find the one of type Button with .Text of "I Accept", move the mouse location to the to the middle of the button (Button.Location.X + button.width/2, Button.Location.Y + button.height/2) then click the left mouse button programmaticaly. This example should help
Thanks for the reply tlhintoq.
Well, the problem is that i am getting the html programmatically through WebRequest, so i really don't have a physical button to click on. Although i could use a WebBrowser control and invoke the Click method, i'd rather don't, since it will be just a temp patch, with a hidden control.
So, i am getting the html and i did look for a submit input control, which i can find, but i think i need a way to construct a POST method and send it back... and that's where the trouble comes. I have tried using Fiddler to help me construct the data that i will post with no luck. I was also wondering if i should post back the __VIEWSTATE value.
You should postback exactly what the browser would postback. Which probably having to parse certain values out of the disclaimer page as well.
Also, if it is not set for you automatically with the HttpWebRequest object, be sure to add the Session header line to make sure the server remembers who you are
Hi. With a little delay, i want to thank Plater for the suggestion. That was what i needed. Once i post back the session header, it all worked.
Cheers
what u mean "post back the session header" could u send me th sample code ????
There's the ASP.NET_SessionId cookie that needs to get sent back and forth Cookie: ASP.NET_SessionId=eljyrbah1bfw5245z0altaf3
Which means you have to look at the servers response to get the correct value for it, and send it with all your requests
i see , as u r working on this , i had question befor i asked in this forum , unfortunetly nobody send me any reply , i try to get the source off each page of one web site but in that website they use linkbutton and with link button should go throw __dopostback , i try to send the form post with __evenargument and __eventtarget but it dosnt work , if u have any exprine about this ??? please send me reply
regards
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Liqun Xu |
last post by:
Hallo NG,
I created a Button with Click-Event dynamically:
System.Web.UI.WebControls.Button bt_1 = new Button();
bt_1.Click += new EventHandler(bt_1_click);
and I implemented the Funktion...
|
by: CW |
last post by:
I have message entry screen that's causing me a bit of an issue. At the
moment, there are 2 buttons, one is used to send message to another user
(btnSend) and another is used to send messages to...
|
by: Imran Aziz |
last post by:
Hello All,
I have a search text and button that post data and my button handler
filters the repeater control. However when the button is clicked the first
time. The page_load event is being called...
|
by: Demetri |
last post by:
I have created a web control that can be rendered as either a linkbutton or a
button. It is a ConfirmButton control that allows a developer to force a user
to confirm if they intended to click it...
|
by: Chu |
last post by:
Thanks everyone for taking a moment to read this.
I've got a page where I use a LinkButton and I wire up a dynamic event
to the button. When the user clicks the button, the event is fired as...
|
by: Ben |
last post by:
Hello
I have frames set up in an asp.net application and need one frame to refresh
another. Seeing as events need to be registered at the time the page is sent
from the server, I was wondering...
|
by: GauravGupta |
last post by:
i want to know that is it posible to call button click event before
page load event on post back....
please help me....
|
by: daonho |
last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
|
by: ADN |
last post by:
Hi,
I am currently extending the GridView control and would like to add a
button to the GridView so that it will automatically render one
button
at the top of the grid. I have a click event for...
|
by: chrisp |
last post by:
I have an ASP.NET 2 page with a button that causes a credit card transaction
to be authorised. The authorisation procedure may take a few seconds and so
I want to prevent the user from clicking the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |