Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to authenticate via HTTPS in code
Message
From
18/07/2003 17:10:11
 
 
To
All
General information
Forum:
ASP.NET
Category:
Web forms
Title:
How to authenticate via HTTPS in code
Miscellaneous
Thread ID:
00811695
Message ID:
00811695
Views:
34
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.
Next
Reply
Map
View

Click here to load this message in the networking platform