views:

65

answers:

2

Hello I have a page in an ASP.NET (website) project that writes a file to the App_Data folder.
When I request the page from my browser everything works.
When I perform this request from a cron-job scheduled job from my provider I get the following error

Could not find a part of the path 'C:\xxxxxxxxxxxxxxx\App_Data\Art_P00004.txt'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamWriter..ctor(String path, Boolean append)
   at System.IO.File.CreateText(String path)
   at AanbiedingProcessor.DoWriteFiles()
   at TskSendAanbiedingen.DoWork()

Can anyone help me ?

The cron jon runs on another host/domain as the asp.net website. I assume it just makes a web request.

A: 

This is likely to be a permissions issue.

Ensure the user account associated with the scheduled job has access to the App_Data folder.

Process Monitor can help to check exactly what is failing and why.

Richard
The asp.net website is hosted on a server.The scheduler is on another server.When I activate from my browser I assume I have the same permissions as the scheduler. Or could it be different ?
Julian de Wit
I would expect so, but Process Explorer will help confirm that. In cases like this when your assumptions are untrue, you need to go back to basics, and validate everything.
Richard
A: 

The problem was that the path did not exist.. :(
The script called from the scheduler was different from the script (location) called within the browser. Excuse me for the confusion..

Julian de Wit