I'm a beginner so please be gentle.....
I want to (if its possible) post information to a web based form from my
windows form app and receive the resulting data from the web page.
The web forms code appears to be in javascript (not sure if that is
relevent).
I have tried, as a test, using the example code (see below), but the only
data I get back is the actual web page the data is on, without the resulting
data (as if the page is just reloading). Is this something I am doing wrong
(likely) or prehaps a restriction of the web site not allowing remote
submittions? The web form itself only requires a single field to be input.
The code I have tried:
Dim uriString As String
Console.Write(ControlChars.Cr + "Please enter the URI to post data to{for
example, http://www.contoso.com} : ")
uriString = Console.ReadLine()
' Create a new WebClient instance.
Dim myWebClient As New WebClient
Console.WriteLine(ControlChars.Cr + "Please enter the data to be posted to
the URI {0}:", uriString)
Dim postData As String = Console.ReadLine()
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
' Apply ASCII Encoding to obtain the string as a byte array.
Dim byteArray As Byte() = Encoding.ASCII.GetBytes(postData)
Console.WriteLine("Uploading to {0} ...", uriString)
' Upload the input string using the HTTP 1.0 POST method.
Dim responseArray As Byte() = myWebClient.UploadData(uriString, "POST",
byteArray)
' Decode and display the response.
Console.WriteLine(ControlChars.Cr + "Response received was :{0}",
Encoding.ASCII.GetString(responseArray)) 3 1120
Its ok - worked it out. I wasn't naming the input fields so the form was
getting confused....rather like me.
Now I just need to work out how to grab the data out of the HTML .....
"Flashster" <xy*@abcde.com> wrote in message
news:uj**************@tk2msftngp13.phx.gbl... I'm a beginner so please be gentle.....
I want to (if its possible) post information to a web based form from my windows form app and receive the resulting data from the web page.
The web forms code appears to be in javascript (not sure if that is relevent).
I have tried, as a test, using the example code (see below), but the only data I get back is the actual web page the data is on, without the resulting data (as if the page is just reloading). Is this something I am doing wrong (likely) or prehaps a restriction of the web site not allowing remote submittions? The web form itself only requires a single field to be input.
The code I have tried:
Dim uriString As String
Console.Write(ControlChars.Cr + "Please enter the URI to post data to{for example, http://www.contoso.com} : ")
uriString = Console.ReadLine()
' Create a new WebClient instance.
Dim myWebClient As New WebClient
Console.WriteLine(ControlChars.Cr + "Please enter the data to be posted to the URI {0}:", uriString)
Dim postData As String = Console.ReadLine()
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
' Apply ASCII Encoding to obtain the string as a byte array.
Dim byteArray As Byte() = Encoding.ASCII.GetBytes(postData)
Console.WriteLine("Uploading to {0} ...", uriString)
' Upload the input string using the HTTP 1.0 POST method.
Dim responseArray As Byte() = myWebClient.UploadData(uriString, "POST", byteArray)
' Decode and display the response.
Console.WriteLine(ControlChars.Cr + "Response received was :{0}", Encoding.ASCII.GetString(responseArray))
Done that too - used regular expressions.
"Flashster" <xy*@abcde.com> wrote in message
news:eY**************@TK2MSFTNGP15.phx.gbl... Its ok - worked it out. I wasn't naming the input fields so the form was getting confused....rather like me.
Now I just need to work out how to grab the data out of the HTML ..... "Flashster" <xy*@abcde.com> wrote in message news:uj**************@tk2msftngp13.phx.gbl... I'm a beginner so please be gentle.....
I want to (if its possible) post information to a web based form from my windows form app and receive the resulting data from the web page.
The web forms code appears to be in javascript (not sure if that is relevent).
I have tried, as a test, using the example code (see below), but the only data I get back is the actual web page the data is on, without the resulting data (as if the page is just reloading). Is this something I am doing wrong (likely) or prehaps a restriction of the web site not allowing remote submittions? The web form itself only requires a single field to be input.
The code I have tried:
Dim uriString As String
Console.Write(ControlChars.Cr + "Please enter the URI to post data to{for example, http://www.contoso.com} : ")
uriString = Console.ReadLine()
' Create a new WebClient instance.
Dim myWebClient As New WebClient
Console.WriteLine(ControlChars.Cr + "Please enter the data to be posted to the URI {0}:", uriString)
Dim postData As String = Console.ReadLine()
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
' Apply ASCII Encoding to obtain the string as a byte array.
Dim byteArray As Byte() = Encoding.ASCII.GetBytes(postData)
Console.WriteLine("Uploading to {0} ...", uriString)
' Upload the input string using the HTTP 1.0 POST method.
Dim responseArray As Byte() = myWebClient.UploadData(uriString, "POST", byteArray)
' Decode and display the response.
Console.WriteLine(ControlChars.Cr + "Response received was :{0}", Encoding.ASCII.GetString(responseArray))
Hi, good you found the answer. But maybe you can post some sample code, so
that anyone else who ever needs it doesn't get to "frustrated" when he/she
starts searching google and finds your post and then thinks he has found his
answer only to realize when he reads the post it doesn't help him out.
The ng thanks you in advance :-)
Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)
"Flashster" <xy*@abcde.com> schreef in bericht
news:uF**************@TK2MSFTNGP10.phx.gbl... Done that too - used regular expressions.
"Flashster" <xy*@abcde.com> wrote in message news:eY**************@TK2MSFTNGP15.phx.gbl... Its ok - worked it out. I wasn't naming the input fields so the form was getting confused....rather like me.
Now I just need to work out how to grab the data out of the HTML ..... "Flashster" <xy*@abcde.com> wrote in message news:uj**************@tk2msftngp13.phx.gbl... I'm a beginner so please be gentle.....
I want to (if its possible) post information to a web based form from
my windows form app and receive the resulting data from the web page.
The web forms code appears to be in javascript (not sure if that is relevent).
I have tried, as a test, using the example code (see below), but the
only data I get back is the actual web page the data is on, without the resulting data (as if the page is just reloading). Is this something I
am doing wrong (likely) or prehaps a restriction of the web site not allowing remote submittions? The web form itself only requires a single field to be input.
The code I have tried:
Dim uriString As String
Console.Write(ControlChars.Cr + "Please enter the URI to post data
to{for example, http://www.contoso.com} : ")
uriString = Console.ReadLine()
' Create a new WebClient instance.
Dim myWebClient As New WebClient
Console.WriteLine(ControlChars.Cr + "Please enter the data to be posted to the URI {0}:", uriString)
Dim postData As String = Console.ReadLine()
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
' Apply ASCII Encoding to obtain the string as a byte array.
Dim byteArray As Byte() = Encoding.ASCII.GetBytes(postData)
Console.WriteLine("Uploading to {0} ...", uriString)
' Upload the input string using the HTTP 1.0 POST method.
Dim responseArray As Byte() = myWebClient.UploadData(uriString, "POST", byteArray)
' Decode and display the response.
Console.WriteLine(ControlChars.Cr + "Response received was :{0}", Encoding.ASCII.GetString(responseArray))
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Seymen Ertas |
last post by:
Hi,
I don't know if this is the correct place to post this but i am having a
little problem with the OpenRead function of the WebClient.
Below is the code i am trying to get it to work:
...
|
by: ptass |
last post by:
Hi
I've installed win2k3 sp1 on a machine where an openRead on any given file
was previously working. After installation, I get a webException as follows...
..message "An exception occurred...
|
by: xzzy |
last post by:
I have .net 1.1
c# . . . . .
using System.Net only lists sockets
what do I need to do to be able to do:
using System.Net.WebClient;
|
by: A.M-SG |
last post by:
Hi,
I have an aspx page at the web server that provides PDF documents for smart
client applications.
Here is the code in aspx page that defines content type:
Response.ContentType =...
|
by: Giovanni |
last post by:
Hi Guys,
Really strange problem I am experiencing... I have setup a virtual
directory with Read Only permissions on an ISA/IIS server (SBS 2003). In
that virt. dir., I placed 1 file...
| |
by: vin.dor |
last post by:
Dear All,
I am using WebClient in my Visual Studio .Net 2003 project to download
an image from the Internet. The following is my function:
C# Code:
public static bool downloadFile(string...
|
by: Mad Scientist Jr |
last post by:
For some reason I can't get a WebClient to access an outside URL from
behind our firewall. The code works when it runs outside the firewall.
I turned on windows authentication in the web.config...
|
by: Mike |
last post by:
I am using PowerShell to download an XML file into a string using the
DownloadString(URI) method of System.Net.WebClient object. Sample
commands below:
$Result = $Null;
$WebClient = new-object...
|
by: MichaelSchoeler |
last post by:
Hi,
I'm having problems with the WebClient class regarding UTF-8 encoded data.
When I access a specific webservice directly I can see the data arrives in corretly formatted UTF-8. But when I...
|
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: 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...
| |
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...
|
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: 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,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |