Call a javascript when i call an aspx page with a form html not running on server

F

Fabio Mastria

My application has to call a webpage with some hidden field, fill their
values with some parameters and then call the submit to the form which has
the action property set to a page of another web application.

all of this, did via javascript.

how can i send the data to fill the hidden fields to this web form?

Please help me, thank you!
Fabio
 
P

Patrice

Not sure what is the particular problem. The simplest would be to create the
page server side with those hidden fields already filled with values. If you
have to get them from client side inputs you could use
getElementById('MyClientSideControlID').value='MyValue' to fill the value of
a field form. The "form.submit" method allows to programmatically submit the
form...

My personal preference would be likely to do that server side using
System.Net.WebClient (it allows to send a POST query with form values to a
particular target page and get the response).

If you prfer doing still cleint side, you may want to be a bit more specific
about the exact point that causes the problem (not sure if it's filling the
hidden fields, submitting the data or whatever else...)
 
P

Patrice

Ah. If I finally understood the page that contains those hidden fields is
not yours.

Your application must submit to this page values as if they were coming from
those hidden fields...You'll have then to send a request to this page with
the same field names (either by "reproducting" this page client side or by
sending a request server side by using System.Net.WebClient).

Note though that the page that contains those hidden fields could also
perform additional checks to see if data are coming from itself instead from
an external source (i.e. in most cases the site owner should document how to
do this, else it could be even not possible if the appropriate safety
measures have been implemented to prevent this).
 
A

adwb

What type of application are you writing? Is it an ASP.NET app running on
your server that users will interact with to fill form fields and submit a
form on a page running on another server?
 
F

Fabio Mastria

adwb said:
What type of application are you writing? Is it an ASP.NET app
running on your server that users will interact with to fill form
fields and submit a form on a page running on another server?

asp.net web application.
Ah. If I finally understood the page that contains those hidden
fields is not yours.

The page with the hidden fields, is in my application.

this page has to be submitted to another page which is not in my
application.

After some operation, i have to call my page, fill the hidden fields and
submit via post the form to that page which is not in my application.

My page sounds like

<form id="form1" action=www.notmyapplication.com/notmypage.aspx
method="post" >

hiddenfield1

hiddenfield2

....

</form>

the notmypage read the hiddens, and call a page in my application with some
value to read via Request object.

That's it.

A question: can I use a server form with action and method using then a
server button which submit the form? This to send post to the
notmypage.aspx...

In this case, I can fill via server side the hiddend fields values..


Your application must submit to this page values as if they were
coming from those hidden fields...You'll have then to send a request
to this page with the same field names (either by "reproducting" this
page client side or by sending a request server side by using
System.Net.WebClient).


sorry I don't know how to use the webclient class, have you some example?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top