M
Matt Frame
I am working on a special ASP.Net application that receives files from
customers. The connection is made via HTTPS and the client sends the file
as a POST to my ASP.Net listener. All of this works fine. Now I am looking
at how to validate the clients certificate programmatically. The client
application sends to me with something like:
....
Dim myHttp As HttpWebRequest =
CType(WebRequest.Create(https://myserver/Receive.aspx), HttpWebRequest)
myHttp.Timeout = 300000
myHttp.KeepAlive = True
myHttp.ContentLength = PostData.Length
myHttp.UserAgent = "Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)"
myHttp.Method = "POST"
myHttp.AllowAutoRedirect = True
'-- Cert Stuff
Dim cert As X509Certificate =
X509Certificate.CreateFromCertFile("d:\temp\cert\ProdCert.cer")
myHttp.ClientCertificates.Add(cert)
Dim tmpStream As Stream
Try
tmpStream = myHttp.GetRequestStream()
Catch ex As WebException
End Try
tmpStream.Write(PostData, 0, PostData.Length)
tmpStream.Flush()
tmpStream.Close()
....
This process seems to work fine, but then I perform a
Request.ClientCertificate in my Receive.aspx nothing is there. In my
Receive.aspx page I have the following code:
Dim cert as HttpClientCertificate
cert = Request.ClientCertificate
Nothing comes across or at least doesn't seem to populate the
ClientCertificate object. If I use the above client to send data to
another system that is Java based they say the client certificate is there.
Can Java do something that .Net can't?
I hope someone can shed some light into why the client certificate is not
showing up in the ClientCertficate object as I am really hoping to keep this
project small by staying in the same language environment.
Thanks,
Matt
customers. The connection is made via HTTPS and the client sends the file
as a POST to my ASP.Net listener. All of this works fine. Now I am looking
at how to validate the clients certificate programmatically. The client
application sends to me with something like:
....
Dim myHttp As HttpWebRequest =
CType(WebRequest.Create(https://myserver/Receive.aspx), HttpWebRequest)
myHttp.Timeout = 300000
myHttp.KeepAlive = True
myHttp.ContentLength = PostData.Length
myHttp.UserAgent = "Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)"
myHttp.Method = "POST"
myHttp.AllowAutoRedirect = True
'-- Cert Stuff
Dim cert As X509Certificate =
X509Certificate.CreateFromCertFile("d:\temp\cert\ProdCert.cer")
myHttp.ClientCertificates.Add(cert)
Dim tmpStream As Stream
Try
tmpStream = myHttp.GetRequestStream()
Catch ex As WebException
End Try
tmpStream.Write(PostData, 0, PostData.Length)
tmpStream.Flush()
tmpStream.Close()
....
This process seems to work fine, but then I perform a
Request.ClientCertificate in my Receive.aspx nothing is there. In my
Receive.aspx page I have the following code:
Dim cert as HttpClientCertificate
cert = Request.ClientCertificate
Nothing comes across or at least doesn't seem to populate the
ClientCertificate object. If I use the above client to send data to
another system that is Java based they say the client certificate is there.
Can Java do something that .Net can't?
I hope someone can shed some light into why the client certificate is not
showing up in the ClientCertficate object as I am really hoping to keep this
project small by staying in the same language environment.
Thanks,
Matt