Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTPWebResponse Returns 403 When Called by Sub Procedure

Status
Not open for further replies.

skibum019

IS-IT--Management
Dec 13, 2001
25
US
I have a very strange occurrence in an application I am writing to transmit an XML file to a customer's https server. I am using the httpwebrequest with x509Certificates to authenticate to their system and post these files to them. Here's where it gets strange.
(Stage 1 - Manual Submittal of Files)
I have been successful in sending these files to their system and continue to be successful when I directly call the sub procedure used for sending the files from a button on a form. This has been validated and the customer has valdiated that they are receiving the files ok under this circumstance.
(Stage 2 - Automatic Submittal of Files)
We are trying to automate the process which includes monitoring a folder for new files and when files are found, calling a subprocedure that loops through all of the files in the folder and for each file, then calls the subroutine to transmit the individual file to the customer. This is whhere the system errors out, returning a 403 error stating that "The remote server returned an error: (403) Forbidden."

Any help would be greatly appreciated.
 
Sorry, I should have clarified that a little better. No, the automated script is not running as a service. It is setup in such a way that I can run it either by a timer I have on the form or by clicking a button that initiates the code. In the background the button causes a script on the form to run that collects the path of the files to send into an array and passes that array to a sub procedure in a class module that then handles enumerating through the array and, on each time through, calling the same procedure to transfer the files to the customer.
 
New development:
I can now use the function to send 1 file at a time with a sigificant interval between attempts. This immediately started working once I installed VS2K5 SP1 and the Vista updates for SP1. I assume that may have had some impact on the function.
I have also contacted our customer and they stated that I should be able to send multiple files in the same connection or even parrallel connections. I will take a look at my code and see if I can use the same connection and loop through my files while in a single connection.
 
It could be a security issue. The timer is running on a different thread than the interface, so Windows firewall/security could be blocking the request from going out under the impression that the thread is running on some sort of default local user account. You could try forcing the other thread to impersonate your user account, or you could try to force the request to go out from the primary thread using the me.InvokeRequired and me.BeginInvoke methods.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top