473,232 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,232 software developers and data experts.

getting 403: forbidden when attempt to access SSL secured webservice

Hi,

I have an ASP.net page, written in VB.net. In that code I want to access a
validator web services that is secured via SSL. I have installed the
certificate, via a .pfx file, on the system. I can browse to the service
and appear to be getting through However, from my server page I cannot
access the web service. The call to the service generates the exception
"Request failed with HTTP status 403: Forbidden".

I had previously received this error when I attempted to access the service
via IE. But specifying the appropriate Client Certificate when asked seemed
to fix the problem. I read that I need to do something similar in code so I
implemented the ICertificatePolicy class's member CheckValidationResult()
returning true. The code I use to do this is:

Public Class NetPolicy implements ICertificatePolicy

Public Function CheckValidationResult (....) as boolean
Return True
End Function

End Class

The code that calls the webservice ValidateWS() is:

Function Validate(id as integer) as boolean

dim result as boolean

System.Net.ServicePointManager.CertificatePolicy = new NetPolicy
result =WebServer.ValidateWS(id) ' this is where the exception is
generated
return result

End function
Any thoughts or pointers?

Thanks,

Jerry
Nov 23 '05 #1
3 9907
BTW, the error is also generated on a VB.net winform app.
"JerryK" <je****@nospam.com> wrote in message
news:OM**************@TK2MSFTNGP15.phx.gbl...
Hi,

I have an ASP.net page, written in VB.net. In that code I want to access
a validator web services that is secured via SSL. I have installed the
certificate, via a .pfx file, on the system. I can browse to the service
and appear to be getting through However, from my server page I cannot
access the web service. The call to the service generates the exception
"Request failed with HTTP status 403: Forbidden".

I had previously received this error when I attempted to access the
service via IE. But specifying the appropriate Client Certificate when
asked seemed to fix the problem. I read that I need to do something
similar in code so I implemented the ICertificatePolicy class's member
CheckValidationResult() returning true. The code I use to do this is:

Public Class NetPolicy implements ICertificatePolicy

Public Function CheckValidationResult (....) as boolean
Return True
End Function

End Class

The code that calls the webservice ValidateWS() is:

Function Validate(id as integer) as boolean

dim result as boolean

System.Net.ServicePointManager.CertificatePolicy = new NetPolicy
result =WebServer.ValidateWS(id) ' this is where the exception is
generated
return result

End function
Any thoughts or pointers?

Thanks,

Jerry

Nov 23 '05 #2
You need to export the certficate (without private key) from IE into a .cer
file.

Then you need to open MMC, add the certificates Snap-In and import the certificate
into the trusted root authorities. (also known as the machine store)

Finally, you need to attach the certificate to the request

serviceProxy.ClientCertificates.Add(System.Securit y.Cryptography.X509Certificates.X509Certificate.Cr eateFromCertFile("c:\\yourCert.cer");

-Trevor
Hello JerryK,
BTW, the error is also generated on a VB.net winform app.

"JerryK" <je****@nospam.com> wrote in message
news:OM**************@TK2MSFTNGP15.phx.gbl...
Hi,

I have an ASP.net page, written in VB.net. In that code I want to
access a validator web services that is secured via SSL. I have
installed the certificate, via a .pfx file, on the system. I can
browse to the service and appear to be getting through However, from
my server page I cannot access the web service. The call to the
service generates the exception "Request failed with HTTP status 403:
Forbidden".

I had previously received this error when I attempted to access the
service via IE. But specifying the appropriate Client Certificate
when asked seemed to fix the problem. I read that I need to do
something similar in code so I implemented the ICertificatePolicy
class's member CheckValidationResult() returning true. The code I
use to do this is:

Public Class NetPolicy implements ICertificatePolicy

Public Function CheckValidationResult (....) as boolean
Return True
End Function
End Class

The code that calls the webservice ValidateWS() is:

Function Validate(id as integer) as boolean

dim result as boolean

System.Net.ServicePointManager.CertificatePolicy = new NetPolicy
result =WebServer.ValidateWS(id) ' this is where the exception is
generated
return result
End function

Any thoughts or pointers?

Thanks,

Jerry


Nov 23 '05 #3
Trevor,

Thanks for the reply.

I added the code that adds the certificates to the clientCertificate
collection and that seems to work for the WinForm version. It did not
however, effect the ASP.Net version.

I did as you suggested added the certificates using the MMC. When I
launched the snap in it came up with a dialog that Says, this snap in will
always manage certificates for: My user account, Service Account, or
Computer account. I added the snap in 3 times, once for My User Account,
Computer Account, and Service Account. For the Service Account is asked me
the service name, and I selected the Machine Debugger Account.

I do not have a single certificate but rather three certificates that are
designed to be in 3 different stores. At least that is what the guy who
gave them to me said. We have a root certificate, that resides in the
Trusted Root Certificate Authority. Then there is a intermediate
certificate that resides in the Intermediate Certificate Authorities.
Finally there is a Personal Certificate that resides in the Personal
Certificate Authority. The Personal Certificate's path points to the
Intermediate Certificate, which in turn points to the Root Certificate.

I placed each of these certificates in the appropriate stores for the User,
Service, and Computer accounts. However, I am still generating the 403:
Forbidden error from the asp.net page. I thought this might be an account
issue, but I do have impressionation enabled and am using the administrator
account, which works with the WinForms version.

Any thoughts?

jerrry
"Trevor Pinkney" <tp******@cyence.com> wrote in message
news:43********************@news.microsoft.com...
You need to export the certficate (without private key) from IE into a
.cer file.

Then you need to open MMC, add the certificates Snap-In and import the
certificate into the trusted root authorities. (also known as the machine
store)

Finally, you need to attach the certificate to the request

serviceProxy.ClientCertificates.Add(System.Securit y.Cryptography.X509Certificates.X509Certificate.Cr eateFromCertFile("c:\\yourCert.cer");

-Trevor
Hello JerryK,
BTW, the error is also generated on a VB.net winform app.

"JerryK" <je****@nospam.com> wrote in message
news:OM**************@TK2MSFTNGP15.phx.gbl...
Hi,

I have an ASP.net page, written in VB.net. In that code I want to
access a validator web services that is secured via SSL. I have
installed the certificate, via a .pfx file, on the system. I can
browse to the service and appear to be getting through However, from
my server page I cannot access the web service. The call to the
service generates the exception "Request failed with HTTP status 403:
Forbidden".

I had previously received this error when I attempted to access the
service via IE. But specifying the appropriate Client Certificate
when asked seemed to fix the problem. I read that I need to do
something similar in code so I implemented the ICertificatePolicy
class's member CheckValidationResult() returning true. The code I
use to do this is:

Public Class NetPolicy implements ICertificatePolicy

Public Function CheckValidationResult (....) as boolean
Return True
End Function
End Class

The code that calls the webservice ValidateWS() is:

Function Validate(id as integer) as boolean

dim result as boolean

System.Net.ServicePointManager.CertificatePolicy = new NetPolicy
result =WebServer.ValidateWS(id) ' this is where the exception is
generated
return result
End function

Any thoughts or pointers?

Thanks,

Jerry


Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ed Swartz | last post by:
I installed SP4 for Windows 2000. Prior to the upgrade my system was at SP3 and I was able to run ASP scripts from my browser just fine. For exmaple: ...
2
by: Nilay Shah | last post by:
Hi, I am trying to connect to web page using following code: client = new WebClient(); strURL = ConfigurationSettings.AppSettings .ToString(); client.DownloadFile...
1
by: Guru | last post by:
Hi I am accessing the TransUnionNetAccess's secured site requesting for the Credit Score. Since i have the p12 certificate i am using third party dll to convert p12 to x509 certificate. ...
1
by: BuddyWork | last post by:
Hello All, I'm using VS2003.NET Framework 1.1 with Microsoft Application Center Test. I am doing stress testing on a webservice. The method of the webservice has the following code. public...
1
by: DotNetter | last post by:
I have two computers. Both computers have Windows 2003 installed as well as Visual Studio.Net 2003 installed. Computer A has active directory set and also has .Net and the webservice called...
2
by: Matthew.DelVecchio | last post by:
hello, i am working on my first web service project. i am writing a webpage that consumes a ws from one of our partners, so i do not have access to the ws code itself. this partner uses...
0
by: Mark Gankin | last post by:
Hi, I'm trying to call Web Service located on my computer from asp.net web application: WebService ws = new WebService(); ws.Credentials = new NetworkCredential("user", "pwd",...
1
by: PK9 | last post by:
I am receiving the following error in Visual Studio 2003: "the web server reported the following error when attempting to create or open the web project HTTP/1.1 403 Access Forbidden" I am...
6
by: Doug Ferguson | last post by:
I am using a webservice client that was created from a WSDL file in .Net 1.1. The client ALWAYS works the first time I call it. The second call returns one of two exceptions. It either returns...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.