Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 25th, 2007, 02:09 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default submit a form at ASP server side

Hi,

I am trying to auto generate hundreds of filled form (data obtained from the database) and submit them just by using the ASP script at server side. Is this possible? Thank you

Dave

 
Old March 25th, 2007, 07:23 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found that we can use xmlHTTP.

Submit the form to a script on your server then create a xmlHTTP post to post the datato the form. You will receive a response that you can then output to the user.

form.asp

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
If Len(Request.Form) > 0 Then
dim strResponse,destURL,strContent

destURL = "http://domain.com/script.asp"
Response.Write destURL
'Construct the Post Data
strContent = strContent & "name=" & server.URLencode(Request.Form("name"))
strContent = strContent & "&pass=" & server.URLencode(Request.Form("pass"))

'Construct the useragent and send
set http_obj=server.CreateObject("MSXML2.ServerXMLHTTP ")
http_obj.Open "POST", destURL , false
http_obj.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
http_obj.send(strContent)


'Grab the response
strResponse = http_obj.ResponseText

set http_obj=nothing
Response.Write "Form sent"
response.write( strResponse )

End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<form name="form1" method="post" action="">
<p>Name:
<input name="name" type="text" value="joe">
</p>
<p>Pass:
<input name="pass" type="password" value="1234">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>



script.asp

<H1>Thankyou for posting data</H1>
<p>Here are the results</p>
<%
For Each Item In Request.Form
Response.Write Item & ": " & Request.Form(Item) & "<br>"
Next
%>

The HTML output of this page will be the strResponse variable.
-------------------------------------

HOWEVER, i'd like to submit the form at ASP server side, the go to the destination page that received the form... Any hints? thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Side Viewstate in ASP.NET 2.0 vikaspatyal ASP.NET 2.0 Professional 1 December 18th, 2007 12:26 AM
Help with asp server side validation nkodali Classic ASP Basics 0 July 16th, 2007 04:02 PM
automate Internet Explorer server side with asp steven_blade Classic ASP Components 2 March 20th, 2007 04:04 AM
ASP.NET server side controls me_shriram VS.NET 2002/2003 3 August 11th, 2003 03:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.