Library tutorials & articles
Interacting with the web using WebRobot v1.0
By Fernando Sanchez, published on 17 May 2006
Uploading files to YouSendIt
We will now make things a bit more complicated for ourselves, by uploading files to YouSendIt. This site allows you to share files by uploading them to a central server, and then warning the recipient of the share that they have a file ready to download.
This page uses JavaScript extensively to modify the content that is presented to the user, and also the fields and actions contained inside the forms, so it will not be as straightforward to use. We will parse the page, and upload a file to a multipart form on this site.
First, we will create a Windows Forms Project. Then, we will d ouble-click on the main form. You should see an empty Load handler:

Write the following code on the Load handler:

This page uses JavaScript extensively to modify the content that is presented to the user, and also the fields and actions contained inside the forms, so it will not be as straightforward to use. We will parse the page, and upload a file to a multipart form on this site.
First, we will create a Windows Forms Project. Then, we will d ouble-click on the main form. You should see an empty Load handler:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
End Sub
Next, we will add a reference to the WebRobot component:
Write the following code on the Load handler:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadOur upload form arrives with zero fields, since the YouSendIt page populates the form dynamically, using JavaScript. For this particular case, we must add the form input fields by hand.
Dim wrobot As New foxtrot.xray.WebRobot
wrobot.Base = "http://www.yousendit.com/"
wrobot.LoadPage("/")
'getting file upload form from page
Dim wform As foxtrot.xray.Form = wrobot.GetFormByName("tform")
'displaying the amount of fields on the form
MessageBox.Show("The form contains " & wform.FieldCount & " fields")
End Sub

Related articles
Related discussion
-
Sharepoint : GroupBy results according to custom property
by sampadasanjay (0 replies)
-
i have struck with my project in vb.net
by jetski (4 replies)
-
Error in VB code
by glib162002 (0 replies)
-
Very slow inserts using SqlCommand.ExecuteNonQuery()
by porchelvi (1 replies)
-
Datagridview Setting datasource property of datagridviewcomboboxcell at run time
by sairfan1 (2 replies)
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum)
Events coming up
-
Dec
6
Developing AJAX Web Applications with Castle Monorail
London, United Kingdom
Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!
Yes it'll save a plenty of work, thanks .
That looks very nice. It'll save me plenty of work when posting a form instead of hardcoding all the fields in a webrequest! http://www.fixx.be
This is a Very Good Example.I thin its very usefull to me.
but the problem is when i try this this not work properly error occured at this line "Dim wrobot As New foxtrot.xray.WebRobot()"
it displayes "File or Assembly name System,or one of its dependancies was not found."
Please answer to me.
This thread is for discussions of Interacting with the web using WebRobot v1.0.