473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Posting a public web page.

I need to be able to create a class in C# that will allow me to navigate to a
public website "www.arin.net" (American Registry for Internet Numbers). The
web page has a single text box where I can input an IP address. Then I have
to press a button called "Search WHOIS". Then in the next page, I will get
the name and address of the entity that owns that IP address. How can I
simulate the actions of entering a value in a text box and pressing the
button to do the search? I do not have access to the underlying application
for "www.arin.net", so I could not use a code behind C# program to directly
assign a value to the ".Text" property of the text box, and then capture a
"button_click" event to do an ASP page postback. So how can I perform a
similar action on a public web page, but using C#? Should I use one of the
new C# classes like "WebRequestMethods.Http.Post"? I am a junior level
developer, so if you can give me as much coding detail as possible, I would
be very grateful. Thank you.
--
Basil Eliopoulos
Apr 5 '06 #1
1 2586
Basil,

When you submit form information, it's nothing more than just packaging
up the details in the proper request.

What youw ant to do is look at the HTML for the page. Look for the form
element that has the button in it that you click, as well as the textbox.
The textbox is an input element. The name attribute on that element is part
of the value you have to send to the server.

On the form element, you have an "action" attribute. This attribute has
the URL that the information is sent to.

Once you have all of this information, you can create an HttpWebRequest
instance (through the static Create method on the WebRequest class, passing
the URL in the action attribute). Then, you would call GetRequestStream and
write the name/value pair to the stream (the name being the name of the text
field, the value being the HTML encoded value you would put in the textbox).
Then, you call GetRequest and you would be able to read the stream which
contains the HTML.

Oh, last thing, you will need to set the content type header to
"x-www-application-urlencoded" as well.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Basil Eliopoulos" <be*********@community.nospam> wrote in message
news:57**********************************@microsof t.com...
I need to be able to create a class in C# that will allow me to navigate to
a
public website "www.arin.net" (American Registry for Internet Numbers).
The
web page has a single text box where I can input an IP address. Then I
have
to press a button called "Search WHOIS". Then in the next page, I will get
the name and address of the entity that owns that IP address. How can I
simulate the actions of entering a value in a text box and pressing the
button to do the search? I do not have access to the underlying
application
for "www.arin.net", so I could not use a code behind C# program to
directly
assign a value to the ".Text" property of the text box, and then capture a
"button_click" event to do an ASP page postback. So how can I perform a
similar action on a public web page, but using C#? Should I use one of
the
new C# classes like "WebRequestMethods.Http.Post"? I am a junior level
developer, so if you can give me as much coding detail as possible, I
would
be very grateful. Thank you.
--
Basil Eliopoulos

Apr 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jonathan M. Rose | last post by:
I am looking for a script that I can sit on an HTML server (Linux, Apache, PHP/Perl/Python/Etc.) that will allow me to do the following things: 1) Post news articles that consists of (i) a title...
3
by: Roger Walter | last post by:
I have a .Net web page that is posting twice after the submit button is clicked once. How can that happen? I have turned tracing on and it writes two records to the trace log and posts twice. ...
4
by: ani | last post by:
I have a datalist control in my aspx page(this is paginated and everytime submits to itself). I am calling a function within my datalist that returns a html control (radio button ) in the form of...
5
by: Bryan | last post by:
I am trying to get to a label control to get its Text value. from a previous page. The label control is buried in a Web User Control that is in a webpart zone. When I use this code:...
4
by: Alan Silver | last post by:
Hello, I would like to add a search text box to the master page, so that it appears on every page of the site. I then want the button next to the search box to do a cross page post to the search...
2
by: theWizard1 | last post by:
Using Visual Studio.Net 2005, Asp.Net 2.0, and trying to use technique shown in the Programming Asp.Net 3rd Edition by O'Reily, page 257. On the first page, this would become the previous page, I...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
3
by: =?Utf-8?B?Q2hhcmxlc0E=?= | last post by:
I'm using Win XP pro Visual Studio 2005 with ASP.net 2.0 and C# in Stephen Walther's ASP.net 2.0 unleashed he gets you to do a Submit button example with it's postBackUrl set to a different page...
44
by: Bruce Wood | last post by:
This subject has come up several times in this group over the last year. Several people in this group seem to feel strongly about this topic. Rather than derail other threads with this discussion,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.