Aspose.word and asp.net


#1

Does Aspose.word work with asp.net. I get an access denied error. I added asp.net and everybody (just in case) and gave full permissions to the aspose.word dll but to no avail. Your help would be appreciated.

thanks

Mike


#2

Hi Mike,

Thank you for considering Aspose.

Please make sure you are not using Document.Open or Document.Save without path so the application tries to open or save to some folder where you don’t have permissions.

Post your code here if it doesn’t help.


#3

I commented out all code and was left with this:

Document d = new Document ()
This line alone gives the following error:

"system.io.fileloadexception: Access is denied:‘Aspose.Word’"

your help would be appreciated
thanks
Mike


#4

Please provide the following information:

1. Did you use msi installer to install the component?

2. When you added a reference to Aspose.Word.dll, it had to be copied into the bin folder of your project automatically. Is it there?

3. What .NET and VS versions do you use?


#5
  1. I downloaed the dll. when i tried to download the msi and ran the installation it gave me an error to the effect that the installation was corrupted. I repeated this a few times to no avail

    2. yes its in there. just to be sure i tried out the initialization Document d = new Document () in a windows application and it was fine

    3. im using the latest .net framework version that is downloaded when you do windows updates. the version is 1.1.4322 SP1. the version of visual studio.net is 7.1.3088

    thanks

#6

oh and another thing. i checked the permissions on the dll that was copied into the bin folder and it has everyone and full control


#7

Dmitry’s timezone is in the night so I’ll try to help.

It does not look like the problem is related to file permissions on aspose.word.dll.

The fact that you could not download the .msi properly is worrying. The same might have happened to the .zip yet it somehow extracted and you are now dealing with corrupted aspose.word.dll that simple does not load and causes that strange exception.

We have many customers and evaluation users downloading and using .msi and .zip without problems. Please try redownloading, maybe from another computer if you can.

It would be best if you can get the .msi downloaded properly and installed, it should then all work from there. You don’t need to give file permissions to aspose.word.dll.


#8

Hi,

I tried downloading the msi again. I selected the last hotfix version. the Error that I get during the installation is "the cabinet file c7e40f . . . required for this installation is corrupt and cannot be used.

I tried downloading the non-fix version which is first on the list and I get the same error.

thanks
Mike


#9

Everyone else downloads the same files okay. So the problem must be on your side.

If you send me your email address to auckland@aspose.com, I will email you the .msi file, it is only 3mb.


#10

Now you have the full product installed and still get access denied in asp.net.

Try if one of our demos work. Open C:\Program Files\Aspose\Aspose.Word\Demos and try both Aspose.Word.Demos (its an ASP.NET demo) and Aspose.Word.Demos.WinForms project if they compile and run okay for you.

There is nothing complex about Aspose.Word. You just need to add a reference to Aspose.Word.dll to your project. Only Aspose.Word.dll file is needed. If that does not help, there must be something wrong with your configuration, sorry it is hard to figure out from here.


#11

as i said before I ran the same code in a windows desktop application and it worked fine. what do i do?


#12

Open, compile and run our ASP.NET demo
C:\Program Files\Aspose\Aspose.Word\Demos\Aspose.Word.Demos

Let me know if that runs okay or not.



#13

having problems compiling the demo. take a look at the following excerpt.

switch (demoName)
{
case “DinnerInvitation”:
return new DinnerInvitationDemo();
case “MailingLabels”:
return new MailingLabelsDemo();
case “EmployeesReport”:
return new EmployeesReportDemo();
case “SalesInvoice”:
return new SalesInvoiceDemo();
case “ProductCatalog”:
return new ProductCatalogDemo();
case “DocumentBuilder”:
return new DocumentBuilderDemo();
case “AlternatingRows”:
return new AlternatingRowsDemo();
case “StampAndWatermark”:
return new StampAndWatermarkDemo();
case “SalesReport”:
return new SalesReportDemo();
case “Barcode”:
return new BarCodeDemo();
default:
throw new Exception(“Unknown demo selected.”);
}
}

missing some breaks arent we?


#14

I did some further investigation. Finally, it appears that the problem occurs only in the one specific project. I tried opening a blank project and put in the initialization line and there was no error. Do you have any idea what I can do now? could it be something in the config file?
thanks


#15

I don’t see any problems with this particular bit is correct. It is all compiled and tested before it is released.

What is the actual compile error?


#16

I probably cannot help if the problem happens with just a particular project. You really need to sort the configuration file, the IIS virtual directory, all settings there etc yourself.


#17

the error is that the case statements fall through. i added breaks after the cases and the error no longer occured.

Now as for the problem at hand. it turns out that for some reason when you created a new project and run it you dont get any errors the first time. the second time you run it it gives you errors. i tried this on a few projects.
any ideas?


#18

I resolved the problem by changing the asp.net settings in machine.config by turning off impersonation. I was running in impersonation mode because I needed to access various COM objects. Could you please look into why the component does not work in impersonation mode.

FInally, the error i get now is Unknown file format.
The code is

Document d = new Document (ResumeInput.PostedFile.InputStream);

The source of course is an attachment
The file opens up fine in word. i also tried a text file but i get the same error.


I would appreciate your help.
thanks


#19

Good to see some progress.

1. The switch and case code in the demo is correct and does not require changes. Breaks are not needed because eacu case is a return statement.

2. The document that you load should be in binary .DOC or .HTML format. Plain text cannot be loaded. Sometimes .RTF documents are given the .DOC extension, such cannot be loaded either, but that would be a different error message. If you are sure the document is a Word document and does not load, there must be some unexpected data or garbage at the start of the InputStream since the document should be at the beginning of the stream. Try saving the file from InputStream into a disk file and opening it in MS Word and in Aspose.Word just for a test.


#20

I created a fresh word file as per your suggestiong but i still get the same error: unknown fileformat. any ideas?

thanks