Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to authenticate via HTTPS in code
Message
De
18/07/2003 17:10:11
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires Web
Titre:
How to authenticate via HTTPS in code
Divers
Thread ID:
00811695
Message ID:
00811695
Vues:
35
Hey! My first post to the .Net forum (I'm mostly a FoxPro guy and not much of one at that)...

So, I need to do an HTTPS POST in VB.Net (code follows). The server I'm posting to will only respond with basic error information, but enough for me to know that I'm not authenticating. I'm wondering if anyone has a few lines of code they wouldn't mind sharing or if someone could tell me what's wrong with mine.

TIA,
Paul
==========
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

Dim webReq As HttpWebRequest
Dim webResp As HttpWebResponse
Dim sr As StreamReader
Dim sw As StreamWriter
Dim strTemp As String

strTemp = "login=abc"

webReq = CType(WebRequest.Create("http://www.domainname.com/somescript.asp"), HttpWebRequest)
webReq.Method = "POST"
webReq.ContentLength = strTemp.Length
webReq.Timeout = 5000
webReq.ContentType = "multipart/form-data"

sw = New StreamWriter(webReq.GetRequestStream)
sw.Write(strTemp)
sw.Close()

webResp = webReq.GetResponse
sr = New StreamReader(webResp.GetResponseStream)

txtResponseC.Text = sr.ReadToEnd.Trim
sr.Close()
webResp.Close()

End Sub
Paul M.
MCSE/MCSA/MCT/MCP+I, A+, Network+, I-Net+
Nil carborundum illegitimi.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform