473,408 Members | 1,861 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,408 software developers and data experts.

How to call HTML (with POST) page from Web form

Hi!
I'm trying to call external HTML web page requiring several POST-ed
parameters from C# Web form. Parameters should be set by Web form. Is it
possible ? How can I do it ?

Thanks in advance

Adam
Nov 17 '05 #1
8 10258
Check the response here:
http://www.computing.net/programming...rum/12267.html

The Parameters variable will hold your form fields in the format:
key=value&key=value

Using an HTTP proxy analyzer tool is also helpful for debugging POST in
C#. MS Fiddler, HTTPLook and others come in useful.

Brett

Nov 17 '05 #2
Hi,

If you past the values in the querystring it will get as GET, not as POST

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Brett Romero" <ac*****@cygen.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Check the response here:
http://www.computing.net/programming...rum/12267.html

The Parameters variable will hold your form fields in the format:
key=value&key=value

Using an HTTP proxy analyzer tool is also helpful for debugging POST in
C#. MS Fiddler, HTTPLook and others come in useful.

Brett

Nov 17 '05 #3
It will perform a POST and you can confirm that in the HTTP debugger
tool.

Brett

Nov 17 '05 #4
> Check the response here:
http://www.computing.net/programming...rum/12267.html


Almost this, but it only calls a service. My goal is to open a browser
window with target URL and POST-ed parameters.
Perhaps I wasn't precise enough :-).

Thanks
Adam
Nov 17 '05 #5
Are you wanting to pre fill a form in the browser or just call the
browser's Navigate() method with your URL parameters included?

You'll need control of an IE instance (ShowDoc object) in either case.
If the first, you'll also need familiarity with MSHTML object. If the
latter, you only need to involve the Navigate() method of the instance
for the POST.

Brett

Nov 17 '05 #6
> Are you wanting to pre fill a form in the browser or just call the
browser's Navigate() method with your URL parameters included?
Just to call a window with parameters POST-ed
If the first, you'll also need familiarity with MSHTML object. If the
latter, you only need to involve the Navigate() method of the instance
for the POST.


Could you tell me where to look for an example ?

Thanks

Adam
Nov 17 '05 #7
I'm not sure what you mean by the first statement. If the FORM has
been POSTed then you are only wanting to get the POST results from the
result page?

On the second question, this is a psuedo example of how to get it
going. I'm actually using a component from Clever Components for most
parsing. I find it to make those task easier and they have excellent
support.

//get things going by declaring the IE instance and referencing MSHTML
for document parsing
private SHDocVw.InternetExplorer IE_Inst = new
SHDocVw.InternetExplorerClass();
private mshtml.HTMLDocument ieDoc;

//use the following for getting at HTML in the document. Make use of
OuterHTML values you see in the debugger. This allows you to parse the
HTML.
mshtml.HTMLBody ieBody;
ieDoc = (mshtml.HTMLDocument)IE_Inst.Document;

//get information about the document body if you need to
ieBody = (mshtml.HTMLBody)ieDoc.body;
DocHeight = (double)ieBody.scrollHeight

//Just an example of doing a POST in the IE instance you've created
NavigateToWebPage(FormPostURL, formFieldString, vHeaders);

You can see I've wrapped the IE Navigate method just to check for null
strings and other validations. I'm also passing in my own Header
string. The actual Navigate uses two here. You'll need to do more
work to get it going but it should give you an idea of how things work.

Brett

Nov 17 '05 #8
> I'm not sure what you mean by the first statement. If the FORM has
been POSTed then you are only wanting to get the POST results from the
result page?


I'm really grateful fo your efforts to clarify this to such a dummie :-) but
let me explain this again:
I code a Web Form in C#. I need to open remote HTML page, which requires
several parameters (using POST method). Now I know, I should use Navigate
method to open a new browser window with given URL, but it's still unclear
how I should pass parameters. I'd really appreciate if you could give me an
example.

Thanks
Adam
Nov 17 '05 #9

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

Similar topics

2
by: Titus Cheung | last post by:
Hello, I want to write some code such that it'll update (ie insert, delete, etc) some data to/from a mySQL database whenever a user hit an HTML form button (ie Submit). Now what I find annoying...
5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
0
by: Prescott | last post by:
I want to execute a javascript function that will set a value in the parent window from the child widow where its called and then post the form to the server. I seem to be able to execute one or...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: moondaddy | last post by:
I'm using vb.net and have an aspx page where I want to call a function in the code behind to do something on the backend and I want to call this function from a jscript function in the aspx page. ...
4
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
3
by: computer_guy | last post by:
Hi Everyone, I run into a problem. I am trying to write an aspx that can dynamically generate an image based on some input parameters. Things are very simple if the size of the parameters is...
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
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:
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...
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
tracyyun
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...
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.