has anyone successfully used HttpWebRequest or WebClient class to simulate
submission of a simple HTML form?
for example: a very simple plain-vanilla form with a textbox and a button.
when the button is clicked the form is submitted with the textbox contents.
could you please post some sample code? thanks.
Nov 18 '05
14 12145
"Joerg Jooss" <jo*********@gm x.net> wrote in message
news:uf******** ******@TK2MSFTN GP11.phx.gbl... John A Grandy wrote: very interesting ....
unfortunately, i'm in a stickier situation than communicating with a public-facing website. [...] i can't disclose the actual url -- but its similar to "https://www.somecompany .com:5555/someservice.asm x/somefunction"
... so apparently the web-server is hosting a .net web-service.
Yes.
i tried your method. i constructed using the data-string successfully used in the Java applet :
postData = "myTextArea=dat aString";
encodingName = "utf-8";
request.GetResp onse();
triggered a runtime error : "500 : internal server error"
do you think the problem might be with encodingName? what do you think good possibilities are ?
or could the problem be in some other area ?
I guess the whole approrach could be wrong then. My sample code showed a programmatic web form submission, but you probably need a SOAP client. Actually, if it is a "proper" Web Service, VS .NET should be able to generate the necessary client-side code for you. The test code you've
posted doesn't fit into the picture at all, though.
I guess you'll need to talk to the Web Service guys to find out what requests their web service can handle.
Cheers,
-- Joerg Jooss jo*********@gmx .net
are the web.config <webServices> settings related to successfully posting to
a remote web-service ?
or do these settings only relate to the hosting of web-services of
web-servers ... ?
for example, by default , the HttpPost setting is not present in web.config
.....
web.config file
<webServices>
<protocols>
<add name="HttpPost" />
</protocols>
</webServices>
"Joerg Jooss" <jo*********@gm x.net> wrote in message
news:uf******** ******@TK2MSFTN GP11.phx.gbl... John A Grandy wrote: very interesting ....
unfortunately, i'm in a stickier situation than communicating with a public-facing website. [...] i can't disclose the actual url -- but its similar to "https://www.somecompany .com:5555/someservice.asm x/somefunction"
... so apparently the web-server is hosting a .net web-service.
Yes.
i tried your method. i constructed using the data-string successfully used in the Java applet :
postData = "myTextArea=dat aString";
encodingName = "utf-8";
request.GetResp onse();
triggered a runtime error : "500 : internal server error"
do you think the problem might be with encodingName? what do you think good possibilities are ?
or could the problem be in some other area ?
I guess the whole approrach could be wrong then. My sample code showed a programmatic web form submission, but you probably need a SOAP client. Actually, if it is a "proper" Web Service, VS .NET should be able to generate the necessary client-side code for you. The test code you've
posted doesn't fit into the picture at all, though.
I guess you'll need to talk to the Web Service guys to find out what requests their web service can handle.
Cheers,
-- Joerg Jooss jo*********@gmx .net
John A Grandy wrote: are the web.config <webServices> settings related to successfully posting to a remote web-service ?
or do these settings only relate to the hosting of web-services of web-servers ... ?
for example, by default , the HttpPost setting is not present in web.config .... web.config file
<webServices>
<protocols>
<add name="HttpPost" />
</protocols>
</webServices>
You're right, these lines control whether an ASP.NET based web service
accepts "pure" (non SOAP) requests. The line <add name="httPost"/> should
enable posting. Note this is *disabled* in ASP.NET 1.1 by default.
Cheers,
--
Joerg Jooss jo*********@gmx .net
so, for my purposes of communicating with a remote web service (hosted by a
commercial company) ...
it is *their* responsibility to make sure that their web.config (or
machine.config) is properly setup to accept HTTPPost requests ... ?
"Joerg Jooss" <jo*********@gm x.net> wrote in message
news:eL******** *****@TK2MSFTNG P12.phx.gbl... John A Grandy wrote: are the web.config <webServices> settings related to successfully posting to a remote web-service ?
or do these settings only relate to the hosting of web-services of web-servers ... ?
for example, by default , the HttpPost setting is not present in web.config .... web.config file
<webServices>
<protocols>
<add name="HttpPost" />
</protocols>
</webServices>
You're right, these lines control whether an ASP.NET based web service accepts "pure" (non SOAP) requests. The line <add name="httPost"/> should enable posting. Note this is *disabled* in ASP.NET 1.1 by default.
Cheers,
-- Joerg Jooss jo*********@gmx .net
John A Grandy wrote: so, for my purposes of communicating with a remote web service (hosted by a commercial company) ...
it is *their* responsibility to make sure that their web.config (or machine.config) is properly setup to accept HTTPPost requests ... ?
*Technically* yes.
But in the end, this is decision between business partners ("We want POST!"
"We have SOAP!") and of course of IT security. If I was concerned: They
offer the service, they make they rules, and they need to tell you what you
can do and what you should do.
Cheers,
--
Joerg Jooss jo*********@gmx .net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brent |
last post by:
Hi,
I want to build an app (C#, windows app, or web app, shouldn't make a
difference) that submits an address to the canada post website's address
lookup and then scrape the postal code out of the resulting page. Here is
their page. http://www.canadapost.ca/tools/pcl/bin/advanced-e.asp It uses a
form post.
I would like a basic rundown of how to submit my own info into their results
page (post), and then scrape out the info I need....
|
by: Gregory A Greenman |
last post by:
I'm trying to write a program in vb.net to automate filling out a
series of forms on a website. There are three forms I need to
fill out in sequence. The first one is urlencoded. My program is
able to fill that one out just fine.
The second form is multipart/form-data. Unfortunately, I haven't
been able to fill that out in a way that makes the server happy.
I set up a copy of this form at my web site so that I could see
exactly what a...
|
by: Darran |
last post by:
Hi
I want to be able to retrieve the data from a given URL, fill in the
necessary form fields and submit the form back to the server, all from
within a Windows Application. I can retrieve the HTML from the page,
using the HttpWebRequest class but that is where I have become stuck.
These are the remaining items I would like to be able to do
1 Fill in the necessary fields on the form.
2 Submit the data back to the server
|
by: Jason Manfield |
last post by:
What is the difference (pros and cons) between retrieving data from the web
using System.Web.WebClient and using HttpWebRequest and Response to get the
data? The WebClient download methods seem to neatly encapsulate the multiple
steps (request.Create; request.GetResponse; response.GetResponseStream ...)
required with the traditional HttpWebRequest/Response approach. I am trying
to crawl urls and download data.
|
by: Steve Klett |
last post by:
Hello-
I would like to implement something like what is covered in this article:
http://www.netomatix.com/HttpPostData.aspx
It shows how to post a form programtically vs with an actual form from a web
page.
Basically, I will have a desktop application that will post a form to an
..aspx page.
| |
by: natzol |
last post by:
Hello,
I need to provide the ability to post file and some form elements via
our website (asp.net) to the third party website (asp page). On
http://aspalliance.com/236#Page4 - I found great advices but still
having troubles... it might some obvious error that I am making but I
just dont see it.
==================FIRST - Webclient=================================
|
by: Natalia |
last post by:
Hello,
I need to provide the ability to post file and some form elements via
our website (asp.net) to the third party website (asp page). On
http://aspalliance.com/236#Page4 - I found great advices but still
having troubles... it might some obvious error that I am making but I
just dont see it.
==================FIRST - Webclient=================================
|
by: Mark Rae |
last post by:
Hi,
The following code works:
HttpWebRequest objRequest = null;
try
{
HttpWebRequest objRequest =
(HttpWebRequest)WebRequest.Create("http://www.microsoft.com");
using (HttpWebResponse objResponse =
|
by: ERobishaw |
last post by:
Using Winform app writing a HTTP Post using the following... on the
server side, I get no form fields. Request.Form.AllKeys.Length = 0.
If I put the field/value paris in the URL I can use
Request to retrieve the values,
but POST doesn't work.
There is NO Proxy... the only thing I can think is that ASP.NET is
somehow filtering out the page because I'm obviously not posting the
viewstate??? Seems like there was some setting for this,...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |