ASPX templates
Version 5.x > ASPX templates > How to Post data to another web server View modes: 
User avatar
Member
Member
banjoayorinde-gmail - 10/18/2010 8:28:53 AM
   
How to Post data to another web server
Hi All.

I want to post data from a my KenticoCMS page to an external server.

Am using javascript to build the querystring (variables and values from server controls) to be sent to the server (theUrl). As well calling javascript action command (document.homeform.action = theUrl;)

This works in asp.net outside kenticoCMS using the html submit button calling the javascript function (I have the method="post" set on the form tag).

However, the same process doesn't work when I tried it in KenticoCMS. Infact the html submit button refuse to fire the javascript function (when clicked).

What could be wrong? And what do I need to do to make it work.


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/21/2010 3:04:55 AM
   
RE:How to Post data to another web server
Hi,

Kentico CMS does not allow you to use several form tags on one page (only one is allowed). There is already one form tag used on the page therefore inserting another form tag into page, you creates following code:

<form runat="server"> //kentico
<form method=""post>//your
</form> //your
</form> //kentico

As you can see this in not what you would like to achieve.

If you would like to post data from your form control you can use one of following ways:
1. use iframe and insert the whole page code into it
2. use webclient class to post data instead of form control. You can find an example here: http://www.netomatix.com/httppostdata.aspx

Best regards,
Ivana Tomanickova