This project has moved and is read-only. For the latest updates, please go here.

Course Upload Failure / UnauthorizedAccessException

Topics: Developer Forum
Mar 24, 2007 at 3:30 AM
While uploading a sample SCORM package, I receive the following access exception. I'm using some of the BasicWebPlayer functionality to upload courses. I've changed the web.config so the app writes to c:\Courseware, instead of c:\BasicWebPlayerPackages. The app is able to unzip the course, but when it tries to delete the imsmanifest.xml, the following exception occurs. As a result of this failure, the database does not get updated with the new record.

Here is my code:

LStoreUserInfo currentUser = helper.GetCurrentUserInfo();

PackageItemIdentifier packageId;
ValidationResults importLog;
using (PackageReader packageReader = PackageReader.Create(uploadControl.FileContent))
// Add package, asking to fix anything that can be fixed
AddPackageResult result = helper.PStore.AddPackage(packageReader,
new PackageEnforcement(false, false, false));
packageId = result.PackageId;
importLog = result.Log;

                      1. EXCEPTION OUTPUT ###################
System.UnauthorizedAccessException: Access to the path 'c:\TeamsCourseware\Package2\imsmanifest.xml' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.Delete(String path)
at Microsoft.LearningComponents.Storage.FileSystemPackageStore.ImportFiles(PackageItemIdentifier packageId, PackageReader packageReader) in c:\dev\Juma10\Src\Storage\FSPackageStore.cs:line 293
at Microsoft.LearningComponents.Storage.FileSystemPackageStore.AddPackage(PackageReader packageReader, PackageEnforcement packageEnforcement) in c:\dev\Juma10\Src\Storage\FSPackageStore.cs:line 174
at Upload.UploadPackageButton_OnClick(Object sender, EventArgs args) in c:\Inetpub\wwwroot\TEAMS\Upload.aspx.cs:line 43

Mar 29, 2007 at 2:33 PM
I checked the properties on the folder where the course content extracted and found that I did not have proper permissions to delete items from the directory. I set the necessary permissions (full control) and now I'm getting the following exception:

An exception occurred while uploading a package:

Microsoft.LearningComponents.Storage.LearningStoreSecurityException: Security check failed.
at Microsoft.LearningComponents.Storage.LearningStoreJob.Execute() in c:\dev\Juma10\Src\Storage\LearningStore\LearningStoreJob.cs:line 1089
at Upload.UploadPackageButton_OnClick(Object sender, EventArgs args) in c:\Inetpub\wwwroot\TEAMS\Upload.aspx.cs:line 58

Mar 29, 2007 at 3:04 PM

The application pool security account should have permissions on the PackageStore directory (c:\teamscourseware, in this case) which it seems to have now and also permissions to access the Training database.