473,785 Members | 2,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10299
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=v alue

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******** *************@g 47g2000cwa.goog legroups.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=v alue

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.Interne tExplorer IE_Inst = new
SHDocVw.Interne tExplorerClass( );
private mshtml.HTMLDocu ment 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.HTMLDoc ument)IE_Inst.D ocument;

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

//Just an example of doing a POST in the IE instance you've created
NavigateToWebPa ge(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
11456
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 is that this form can only, from my understanding, execute a separate PHP file with the <form action=removerow.php> code. Or can I call a function? The reason being I find that the form will only pass a single variable to this "removerow.php"...
5
2693
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 function to verify the name fields, age, email and gender. My question is: if I create a function for each field like the code below, what would be the best way to organize the functions and call them? Would I need one main function and place...
0
1848
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 the other but not both. The child page (html) code is: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="AddKeyWord.aspx.vb" Inherits="ComponentSearch.AddKeyWord"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML>...
2
8403
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 submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
2
3050
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. Furthermore I know there will be a postback involved but the state of the page will not change at all so I would like it to be as efficient as possible with no appearance to the user that anything happened. I saw in someone else's code where...
4
4220
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 the server generates the HTML based on a passed in parameter. In our case, CustomerID. Every Customer ges a branded website with there logos and webpage etc.. To Avoid having 1 ASP.Net application running for each client I am attempting a more...
10
6104
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 button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
3
3612
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 small and I can put them on the URL and pass them in as HTTP GET. In my image generation script I just need to read the parameters and then pump out the right MIME type and the right image byte stream. It is also very easy to use:
0
9645
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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,...
0
10324
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7499
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 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...
0
6739
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();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
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
3
2879
bsmnconsultancy
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...

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.