Forum Moderators: open

Message Too Old, No Replies

HTTP Post over SSL?

How to logon from different site?

         

RossWal

6:28 pm on Apr 10, 2003 (gmt 0)

10+ Year Member



I have a site called mysite.com. I want to allow users to log onto theothersite.com using an ID and password they type into a page on mysite.com. The password has to go to theothersite.com over ssl.

Any thoughts on making this happen?

Thanks,
Ross

duckhunter

2:40 am on Apr 11, 2003 (gmt 0)

10+ Year Member



There are a couple of ways. Do you have .NET? If so, check out the httprequest/httpresponse classes.

Classic ASP, you'll have to write a DLL that uses API calls and call it from the web. The API calls are in the WinInet library and are fairly complicated.

Let me know which way and maybe I can help, this is actually my neck of the woods.

RossWal

7:15 pm on Apr 11, 2003 (gmt 0)

10+ Year Member



Thanks Duckhunter. I'll start reading up on the .net version. Any pointers, articals, etc. gladly accepted :)

duckhunter

2:58 am on Apr 13, 2003 (gmt 0)

10+ Year Member



This should get you started:

Imports System.Net
Imports System.IO

Public Function OpenURL(ByVal sURL As String) As String
Dim objRequest As HttpWebRequest
Dim objResponse As HttpWebResponse

objRequest = CType(WebRequest.Create(sURL ), HttpWebRequest)
objRequest.ContentType = "application/x-www-form-urlencoded"
objRequest.Method = "POST" ' Or GET
objRequest.Timeout = 10 'Could have trouble connecting
bjResponse = CType(objRequest.GetResponse(), HttpWebResponse)

If objResponse.StatusCode <> HttpStatusCode.OK Then
'Unsuccessful
OpenURL= objResponse.StatusDescription
Else
'Successful - Read into StreamReader Object
srTemp = New System.IO.StreamReader(objResponse.GetResponseStream())
OpenURL = srTemp.ReadToEnd()
End If

objResponse.Close()
objResponse = Nothing
objRequest = Nothing
End Function

Probably want to wrap the GetResponse in a Try/Catch so you can trap any errors TCP/IP could potentially throw at you.