Solved

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

Posted on 2011-02-11
3
682 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
Comment Utility

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
Comment Utility
Just in case the Asker doesn't speak "jQuery", any chance for a non-jQuery example?
0
 

Author Comment

by:asphaltninja
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now