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!

Creating Excel files in Classic ASP on an intranet

Status
Not open for further replies.

JScannell

Programmer
Jan 9, 2001
306
US
This used to work for be several years ago before I updated Office to 2010. Now some old web code I used to use a lot no longer works. I am creating excel files in vbscript. So here's what's happened:

1. I get a "permission denied" error when this line is executed: Set xlsObject = CreateObject("Excel.Application")
2. So I setup the security settings for Excel using DCOMCNFG and added <pc-name>\IIS_IUSRS giving it full control
3. I then went into the folder where Excel.exe is found (C:\Program Files (x86)\Microsoft Office\Office14) and added the same user to its security settings.
4. I haven't gotten to the point where the file is going to be saved, but I also added that user to the security settings of the folder where the Excel files will be written.

I don't know what else to do. I'm sure someone out there has had to do this before and has a suggestion. Whatever is the final things to do I'm going to write them down in case I need to do it again.

I'm running my site under IIS 6.1 on my desktop computer. This code works on my customer's intranet, but he is using very ole technology that will be going away shortly, but I need to be able to tun this here so I can show him the Before and After that I propose to create printed output differently.

Thanks in advance,
Jerry

Jerry Scannell
 


To use Excel for 'anonymous' access via a HTTP request the "Everyone" User Group needs to have 'full control' permissions to Excel.exe on the server.

Also you should be using Server.CreateObject(... ) for the DCOM object to run in the server context rather than the logged in user context.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
Chris,

Thanks for the response. It's the "Everyone" user that needs the access and not the IIS_IUSRS one? I didn't realize that.

I will check that out.

Do I only need to use dcomcnfg? Or do I also need to add the security to the destination folder?

Jerry

Jerry Scannell
 
It's the "Everyone" user that needs the access and not the IIS_IUSRS one? I didn't realize that.

Okay, to explain the why, it is because HTTP access is 'anonymous' meaning that no user needs to be directly logged to the server. This does not mean that the IIS_USR account is 'logged in' and can access arbitrary file locations, it isn't.
The IIS_IUSRS account is only for running the HTTP Server instance and for accessing files within the site document root location, it does not act as an 'interactive' user account.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
I struggled for years to get office automation to work properly in an IIS/ASP environment and all my research said basically don't try it as it is not reliable/scalable. So hats off to you that you got it to work at all!

Just my tuppence worth - two possible alternatives:

1. Generate the document as HTML and put in an Excel header - you will get a warning saying it's not a "real" Excel file but if you can live with that then it's quite a simple solution.

2. a) on your web page have a button that says Export to SQL. If you click this button it saves the SQL query in a table next to your windows username.
b) write a little desktop HTA app that looks for queries with your name and then uses client side vbscript to execute query and save to Excel.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top