Solved

Need to post asp.net page form to another page/server

Posted on 2011-02-11
3
693 Views
Last Modified: 2012-05-11
My employer outsources some of their record keeping, and as a result some of our client visit our page and then, upon clicking a link, are taken to the consulting firm's site. I'd like to be able to create a page on our site that will post the user's login/password info to the consultant's page.

How can I post our form data to the form on the consultant's site? I'm using c# and JavaScript fyi.
0
Comment
Question by:asphaltninja
3 Comments
 
LVL 20

Accepted Solution

by:
Proculopsis earned 500 total points
ID: 34877863

You could try something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q__26816630.html</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>

<script type="text/javascript"> 

$(document).ready(function() {

  $("#alternate").click( function() {
    var form = $(this).closest("form");
    if ( this.checked ) {
      form.attr( "rel", form.attr( "action" ) );
      form.attr( "action", "https://www.paypal.com/uk/cgi-bin/webscr?cmd=_login-run" );
    } else {
      form.attr( "action", form.attr( "rel" ) );
    }
  });


});

</script>
<style type="text/css">@import "http://images.experts-exchange.com/getCSS?key=/00203/ee_NS|--base,xp--base,--component,xp--component,--formFactory,xp--formFactory,xp--button,xp-include-infoBox&t=1297363483000";</style>
</head>
<body>

<fieldset id="loginPopup" style="width: 300px; padding: 10px; margin-left: auto; margin-right: auto;"><legend>Login</legend>

<form method="post" action="http://www.experts-exchange.com/login.jsp" name="loginPopupForm">
  <input type="hidden" name="msuLoginSubmit" value="1" />
  <div><label for="lpumsuLoginName">Username or Email:</label></div>
  <div><input type="text" id="lpumsuLoginName" name="msuLoginName" value="" class="text" tabindex="1" /></div>
  <div><label for="lpumsuPassword">Password:</label><a href="/forgotPassword.jsp" rel="nofollow" style="margin-left: 48px; text-decoration: none;">Forgot your password?</a></div>
  <div><input type="password" id="lpumsuPassword" name="msuPassword" value="" class="text" tabindex="2"  /></div>
  <div class="rMeBox">
    <div class="rMeInput">
      <label for="alternate">Alternate Login</label>
      <input type="checkbox" id="alternate" name="msuRememberMe" class="checkbox" tabindex="3" />
    </div>
    <div class="rMeShared">Submit login details to affiliate site</div>
  </div>
  <div class="clear"></div>
  <div class="nvpButtons">
   <input type="hidden" name="redirectURL" value="/Programming/Languages/Scripting/JavaScript/Q__26816630.html?qid=26816630" />
   <div class="nvCancel"><a href="#" tabindex="5">Cancel</a></div>
   <button type="submit" class="lpbSubmit" tabIndex="4">Login</button>
   <div class="clear"></div>
  </div>
</form>

</fieldset>

</body>
</html>

Open in new window

0
 
LVL 29

Expert Comment

by:Badotz
ID: 34877953
Just in case the Asker doesn't speak "jQuery", any chance for a non-jQuery example?
0
 

Author Comment

by:asphaltninja
ID: 34878962
Hello and thanks for the reply. I'd also need them to be taken to the other site after being logged in through the page I create.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question