[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

Posting html form to another domain from asp.net page

Hi,
I'm trying to have a login page on 1 new site (an asp.net site) that sends the username, password and a hidden field to another website that will carry out a login procedure.
I have made an html form outside of the rest of the normal asp.net form area (see below).  When the submit button is pressed the browser moves to the correct page but doesn't take the variables with it.

The receiving page is on an NT server, not running .net and it is a pure asp environment.
To look for the variables on the receiving page I have stripped everthying out apart from the following code:

For Each ServerVariable In Request.ServerVariables
Response.Write "<BR>" & "" & ServerVariable & ": " & Request.ServerVariables(ServerVariable) & ""
Next
response.write "P=" & request("txtPassword")
response.write "<BR>U=" & request("txtName")

I'm a bit concerned that either  I've missed something incredibly dumb or this will never work because of something to do with .net .
I currently do a similiar login process from 1 doamin to another where the sending page is pure asp.

Hope someone can help....
Andrew



asp.net form section
<div id="logIn">
<form id="frm_logon" name="frm_logon" action="http://mydomain.com/test.asp" method="post" >
      <asp:label id="lblLoginTitle" runat="server">Professional users log in here:</asp:label><br>
      <asp:label id="lblUsername" runat="server">Username</asp:label>&nbsp;<INPUT class="textfieldSmall" id="txtName" type="text" size="5">
      <asp:label id="lblPassword" runat="server">Password</asp:label>&nbsp;<INPUT class="textfieldSmall" id="txtPassword" type="password" size="5">
      <input type="hidden" name="dom_country" value="uk">
      <INPUT class="textfieldSmall" id="btnLogin" type="submit" value="Login">
</form>
</div>

<form id="Form1" method="post" runat="server">

rest of asp page...
0
andrewh123
Asked:
andrewh123
  • 2
1 Solution
 
ayha1999Commented:
Hi,

use

Server.Transfer("yourpage")

which will transfer all form variabels to next page.

whre you can retrive it like

Request.Form("FieldName")

hope this helps.

ayha
0
 
andrewh123Author Commented:
Hi ayha- thanks for this but (and I'm sorry if this wasn't clear in the question), the page I'm posting to is on another domain.  If I use server.transfer:

Server.Transfer("http://www.mydomain.com/test.asp")

 to the other domain I get the following error:

Invalid path for child request 'http://www.mydomain.com/test.asp'. A virtual path is expected

Cheers
Andrew
0
 
ihenryCommented:
Like the hidden input control you also need to give name to each text input control, like this

<INPUT class="textfieldSmall" id="txtName" name="txtName" type="text" size="5">
<INPUT class="textfieldSmall" id="txtPassword" name="txtPassword" type="password" size="5">
0
 
andrewh123Author Commented:
I knew it would be soemthing dumb - d'oh.

Thanks a lot for spotting this - it was driving me mad, everything works fine now.

Andrew
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now