Hello everybody. I have I think very unusual problem I wrote an ASHX HttpHandler. The function of program is to receive an http request, change it to other format, send the https request to another server using certificate authorisation, receive an answer, change it to other format and return an answer to the first request sender. I made this program in Visual Studio 2005. It was working well and 100% correct in Visual Studio. Then I was enforced to reinstall the operating system (Windows XP).But after I reinstalled the OS, problem appears: the program is not working now, I see following resultin IE: /*
Server Error in '/WebSite7' Application.
The remote server returned an error: (403) Forbidden. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error: (403) Forbidden.
Source Error:
Line 148: Line 149: //receiving an answer from remote server Line 150: HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Line 151: Stream receiveStream = response.GetResponseStream(); Line 152: StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8); | Source File: d:\DOCUMENTS\Visual Studio 2005\WebSites\WebSite7\Babilon.ashx Line: 150
Stack Trace:
[WebException: The remote server returned an error: (403) Forbidden.] System.Net.HttpWebRequest.GetResponse() +945 Handler.ProcessRequest(HttpContext context) in d:\DOCUMENTS\Visual Studio 2005\WebSites\WebSite7\Babilon.ashx:150 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +401 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +117 |
Version Information:Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
*/
The commands, where exception appears was in try-catch block, but I temporary removed the try-catch specially to see, what is the problem... Unfortunatelly, I don't have any idea yet.... Who knows, what is the problem? It's very strange, because it was working before.... Very strange... May be problem is in certificate ? But I exported the certificate receiver from remote server and installed it again... I use following code for certificate authorisation^
System.Security.Cryptography.X509Certificates. X509Certificate Babilon_Certificate =
System.Security.Cryptography.X509Certificates. X509Certificate.CreateFromCertFile(cer_file_path);
ServicePointManager.CertificatePolicy = new CertPolicy();
and then when sending an https request just add following property to it^
request.ClientCertificates.Add(Babilon_Certificate); May be problem is here.... Please help, I'mat a deadlock :(((
Thanx a lot for cooperation. | | Khisrav | Check the permission settings in IIS as well as the file system permissions. 403 is a fairly straightforward error status, and it usually means what it says. John Saunders | Use File->New Project to create Web Service Projects- Unmarked As Answer bynaiculModeratorSunday, January 04, 2009 12:15 PM
- Marked As Answer bynaiculModeratorThursday, January 01, 2009 3:57 PM
- Marked As Answer bynaiculModeratorMonday, January 05, 2009 9:09 AM
- Proposed As Answer bynaiculModeratorTuesday, December 30, 2008 4:43 PM
-
| | John Saunders |
Check the permission settings in IIS as well as the file system permissions. 403 is a fairly straightforward error status, and it usually means what it says.
John Saunders | Use File->New Project to create Web Service Projects
Hi! What John is saying here is to check the configuration of your IIS server, that hosts your app. If you don't know the exact settings you have to modify, you can try and ask this question in the IIS forum: http://forums.iis.net/Regards,
Lucian Baciu, MCTS,
http://studentclub.ro/lucians_weblog - Unmarked As Answer bynaiculModeratorSunday, January 04, 2009 12:15 PM
- Marked As Answer bynaiculModeratorMonday, January 05, 2009 9:09 AM
- Marked As Answer bynaiculModeratorThursday, January 01, 2009 3:57 PM
- Proposed As Answer bynaiculModeratorTuesday, December 30, 2008 4:43 PM
-
| | naicul | Check the permission settings in IIS as well as the file system permissions. 403 is a fairly straightforward error status, and it usually means what it says. John Saunders | Use File->New Project to create Web Service Projects- Unmarked As Answer bynaiculModeratorSunday, January 04, 2009 12:15 PM
- Marked As Answer bynaiculModeratorThursday, January 01, 2009 3:57 PM
- Marked As Answer bynaiculModeratorMonday, January 05, 2009 9:09 AM
- Proposed As Answer bynaiculModeratorTuesday, December 30, 2008 4:43 PM
-
| | John Saunders | Hello,
I'm really sorry, but before I've never made web-applications, I was a database developer, that's why my question may be stupid - which properties I have to change, where ?
Thank you. | | Khisrav | Another detail:
I recompiled my code as .aspx web page. Now it is working correctly from VS, but returns an error(the same error), when I publishing it at the same computer. | | Khisrav | If I'm thinking in correct direction, the ASPNET don'ty have an access to my certificate. I'm trying to give it an access, but unfortunately I don't have any result now... | | Khisrav |
Check the permission settings in IIS as well as the file system permissions. 403 is a fairly straightforward error status, and it usually means what it says.
John Saunders | Use File->New Project to create Web Service Projects
Hi! What John is saying here is to check the configuration of your IIS server, that hosts your app. If you don't know the exact settings you have to modify, you can try and ask this question in the IIS forum: http://forums.iis.net/Regards,
Lucian Baciu, MCTS,
http://studentclub.ro/lucians_weblog - Unmarked As Answer bynaiculModeratorSunday, January 04, 2009 12:15 PM
- Marked As Answer bynaiculModeratorMonday, January 05, 2009 9:09 AM
- Marked As Answer bynaiculModeratorThursday, January 01, 2009 3:57 PM
- Proposed As Answer bynaiculModeratorTuesday, December 30, 2008 4:43 PM
-
| | naicul | Hello!
First I want to congratulate everybody with Cristmas and New Year and wish no errors in new year :))))
I solved my problem by changing web.config file of VS project andmachine.config file to run my application under Administrator account. With default settings it runs under ASNET account, which have no access to certificates.
Now application runs and works correct at my machine. But when I try to intsall it on server problem appears again... I changed web.config machine.config files on server, but here application does not work even under VS - even running under Administrator account!!!I changed so many settings on my mnachine - I even don't remember what I changed - it's funny! I can' finda dependence, why it's happening and I think problem is not in IIS.... Please help...
Thank you.
P.S. I'll check the IIS permissions and try to ask question in iis forums, may be you are write. | | Khisrav | Thank you very much!!! I completely solved the problem! | | Khisrav |
|