Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click here to be sent your password via email <- HOW? 1

Status
Not open for further replies.

PGen

Programmer
Aug 31, 2001
39
GB
Is is possible to submit to a CGI from ASP without using form fields and the browser.

EG. by manually creating HTTP headers

I need this so that i can write a script that sends users their login password via email. Therefore I cant write the password to a hidden field on the browser, as this poses a security risk.

Thanks,

Will
 
Mmmmmm, it is possible to create an e-mail with ASP (i use ASPemail form Persits, which came free with a book). On a classic login page you'll find a 'Forget password?' link. After entering your userid or e-mail your program does a lookup in a user-table, and then generates the e-mail.
br
Gerard
 
Thanks for the reply Gerard,

I had a look at however I dont have access to IIS as it is a remotely hosted server and they wont install it for me. :(

My problem also goes beyond that one I mentioned originally...

Its not email thats the problem, as i can use PHP, CGI and other commonly available Perl scripts to do this via HTML form POST. The problem is with security and not involving the browser for any type of HTML form submission.

Is there any way of creating HTTP Headers to emulate a form submission thereby bypassing the users browser altogether!

I think im going down the road of Perl using STDOUT and have posted a relevant thread on that forum.


Thanks again,

Will
 
Are you saying you want to programmatically POST a html form? Yes you can do that, but it does require a TCP control to do it (you've already stated your ISP won't add new controls for you).

here's a snippet of code from an ASP that opens a connection to a webserver an does a POST to a form

Code:
set Socket = server.createobject("socket.tcp")
Socket.Host = PHost & ":80"
Socket.Open()
Socket.SendLine("POST " & PPage & " HTTP/1.0")
Socket.SendLine("User-Agent: WebPager/0.1")
Socket.SendLine("Content-Type: application/x-[URL unfurl="true"]www-form-urlencoded")[/URL]
Socket.SendLine("Content-length: " & len(PostData))
Socket.SendLine("")
Socket.SendText(PostData)
Socket.WaitForDisconnect()
if instr(Socket.Buffer, PResponse) <> 0 then
	SendPage = &quot;TRUE&quot;
else
	SendPage = &quot;FALSE&quot;
end if
Socket.Close
set Socket = nothing
Wait 3000
End Function

PPage is the the name and path of the form you want to POST

PostData looks like an GET string: (FieldName=Data&AnotherFiledName=MoreData)

-Christian
 
Yup &quot;Invalid ProgID&quot; error - so it's not installed on the NT server and I got an error on the Linux one aswell.

I'll try this header building with perl or php.

A thousand thank-yous,

Will

--------------

Are these correct?

PHost = The 'ORIGIN' Server
PPage = The Destination Page
PostData = The Data
PResponse = whats this exactly???


Here is the full code I used:

<% @LANGUAGE = VBScript %>
<%
Option Explicit
Response.Expires = 0

Call SendPage(&quot;
Function SendPage(PHost,PPage,PostData)
set Socket = server.createobject(&quot;socket.tcp&quot;)
Socket.Host = PHost & &quot;:80&quot;
Socket.Open()
Socket.SendLine(&quot;POST &quot; & PPage & &quot; http/1.0&quot;)
Socket.SendLine(&quot;User-Agent: WebPager/0.1&quot;)
Socket.SendLine(&quot;Content-Type: application/x- Socket.SendLine(&quot;Content-length: &quot; & len(PostData))
Socket.SendLine(&quot;&quot;)
Socket.SendText(PostData)
Socket.WaitForDisconnect()
'if instr(Socket.Buffer, PResponse) <> 0 then
' SendPage = &quot;TRUE&quot;
'else
' SendPage = &quot;FALSE&quot;
'end if
Socket.Close
set Socket = nothing
Wait 3000
End Function

%>
<html>
<head>
<title>Auto-Submit</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
Sent Data...
</body>
</html>
 
U could ask if they have instaled on the Server &quot;CDONTS&quot; files (witch means they has instaled a email server) and the use the Object to send the emails ________
George, M
 
Hi George,

I've tried creating a CDONTS object already, they dont have it installed :(

And not having much luck with the PHP headers either.

But its not email that im too fussed about, its the auto-header FORM data submittion that i am desparately trying to crack atm. If I can solve this then ill be so so happy.

Will

 
Try this way cuz the &quot;socket.tcp&quot; object doesn't exist on the server but &quot;MSWinsock.Winsock.1&quot; does

Code:
PPage=&quot;mypage.htm&quot; 'not asp
set s = server.createobject(&quot;MSWinsock.Winsock.1&quot;)
s.RemoteHostIP=&quot;192.168.0.234&quot;
s.RemotePort=80 'port
s.Connect
s.SendData &quot;POST &quot; & PPage & &quot; http/1.0&quot;
s.SendData &quot;User-Agent: WebPager/0.1&quot;
s.SendData &quot;Content-Type: application/x-[URL unfurl="true"]www-form-urlencoded&quot;[/URL]
s.SendData &quot;Content-length: &quot; & len(PostData)
s.SendData &quot;&quot;
s.SendData PostData
s.Close
set s = nothing
hope this works for u... ________
George, M
 
erm...so the PPage is the ORIGIN of the data post?

If so, then where is the DESTINATION that is being posted to?

Also, is the ip address the ip of the host (origin) server, not the destination server?

Thanks for helping out George.
 
U need to use like SauerC says but the &quot;socket&quot; is replaced to &quot;s&quot;
I dont research this to mutch but i'll try, and if u could provide me with some clues please tell me or email me at
shaddow11_ro@yahoo.com maybe we could get this to work... ________
George, M
 
Hi George, I tried it on both and got errors:

&quot;Server.CreateObject Failed&quot; - on NT
&quot;ASP - An error occurred...&quot; - on Linux (unsurprisingly)

I.E. not installed on either server.

I think im loosing the battle,

Will
 
So we dont have to mutch options...
The objects are on the server but u dont have permision to create the object...

And for your first question could u be more specific maybe we find anothe solution... ________
George, M
 
Well, Ive got two problems to solve:

1. Email Password from Login Page
(without using hidden fields because of security)

2. Simulated Form Data POST


If I can solve #2 then automatically #1 is solved.

Thnx George,

Will
 
Will, u have the password and u want to send an email with it? ________
George, M
 
Yup, the password is in a MySQL DB that i can access via VBScript.

I can also use any of my form-email gateway scripts, but cant put the pw in a hidden field as its a security risk. Thats why im trying to figure out how to simulate a POST.

Thnx,

Will
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top