1110
1110

Reputation: 6839

How to call aspx page without opening it

I have a aspx page that I need to call without going directly on that page.
I have tried to make POST from form but it opens this action url in browser.

<form method="POST" action="http://mysite/actionpage.aspx">

        <input type="submit" value="Submit" />
        </form>

Upvotes: 0

Views: 1963

Answers (4)

Syed
Syed

Reputation: 318

I haven't tested , but looks like you are navigating to .aspx means server page, i.e. you need to use runat="Server" in your tags like this

Upvotes: 0

ClayKaboom
ClayKaboom

Reputation: 1833

You can do it via ajax. For example, if you add a script reference to jQuery things will get much easier, and you can do the following:

<script type="text/javascript">
   function postIt()
   {
     $.post( 
       "http://mysite/actionpage.aspx" 
        , function(data)
        {
          // data was returned from the server 
          alert("data posted in the background");
        } );
   }
 </script>

The processing you be done via background.

Your final HTML woul be :

  <form method="POST" action="http://mysite/actionpage.aspx">     

       <input type="submit" value="Submit" onclick="postIt();" />     
  </form>     

Upvotes: 1

lewiguez
lewiguez

Reputation: 3823

You could use curl if you're on a *nix system.

Here is a reference on how to post data to a page. The result will be returned through the command line.

What is the curl command line syntax to do a post request?

Here is the syntax for reference:

curl -d "param1=value1&param2=value2" http://example.com/resource.cgi

or

curl -F "[email protected]" http://example.com/resource.cgi

Upvotes: 1

Shyju
Shyju

Reputation: 218922

If jQuery is allowed to use in your case, You may use jQuery ajax to call that page

  $("form").submit(function(e){
     e.preventDefault();
     $.post("yoursecondpage",function(data){
       //do whatever with the response from that page
     });    
  });

Upvotes: 1

Related Questions