ASP.NET and SSL

  • Thread starter Jalyah TL via .NET 247
  • Start date
J

Jalyah TL via .NET 247

English:
Hi! I have a problem when I send a request from an asp page toanother with HttpWebRequest. The site requires a certicate toaccess, for this reason I added a certificate to the requestusing the class X509Certificate. The problem is that I get a 403forbidden error message. I guess that is a permission matter. Ialso tried to create a component service to do it, but I obtainthe same error message. You have the code here, thanks inadvance.

Spanish:
Hola! Tengo un problema al enviar una petici?n de una p?gina aspa otra con HttpWebRequest. El sitio requiere de certificadospara poder entrar, as? que a la petici?n le a?ado un certificadopara que me permita abrir la p?gina asp. El problema es que meda un error 403 de prohibido. Supongo que ser? por alg?n tema depermisos pero no se solucionarlo. Tambi?n he intentado crear unservicio de componente que lo haga, pero me da el mismo error.Aqu? os dejo el c?digo para ver si le podeis echar un vistazo.

The code:

Dim datos, respuesta As String
Dim webReq As HttpWebRequest
Dim webResp As HttpWebResponse
Dim sw As Stream
Dim sr As StreamReader
Dim encodedData As New ASCIIEncoding

webReq = HttpWebRequest.Create(url)
webReq.Method = "POST"
webReq.Timeout = 60000
webReq.ContentLength = byteArray.Length
webReq.ContentType = "application/x-www-form-urlencoded"

Dim cert = X509Certificate.CreateFromCertFile(pathcertificado)
webReq.ClientCertificates.Add(cert)

webReq.AllowWriteStreamBuffering = False
sw = webReq.GetRequestStream()
sw.Write(byteArray, 0, byteArray.Length)
sw.Close()

'Obtenemos la respuesta del servidor
webResp = webReq.GetResponse()
sr = New StreamReader(webResp.GetResponseStream())
respuesta = sr.ReadToEnd()
sr.Close()



Gracias. Thanks
From: Jalyah TL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top