[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 773
  • Last Modified:

Create Word file (serverside) as internet-user

I have an online application that creates and saves Word documents server-side. I didn't work until i gave admin-rights to the iis-user or internetuser. I know it's unsafe to do such thing. Does anyone know which specific rights i have to gave to the internetuser in order to let the app work?
0
secuteamers
Asked:
secuteamers
  • 9
  • 7
  • 3
1 Solution
 
Irwin SantosComputer Integration SpecialistCommented:
at least read with script & execute

if they will be saving data, then you have to add modify/write.
0
 
secuteamersAuthor Commented:
yeah, but which process?
0
 
Irwin SantosComputer Integration SpecialistCommented:
what's the application?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
secuteamersAuthor Commented:
A C# (asp.net) application that opens Word, Creates a document and saves it (all serverside)
0
 
Irwin SantosComputer Integration SpecialistCommented:
you need to grant access to execute that ASP.NET file (if you haven't already).

the next thing is to have NTFS permission setup to READ/MODIFY/WRITE on the folder that will host the saved files

AND

go into IIS and make sure that you have setup authentication for that access to the folder.
0
 
secuteamersAuthor Commented:
it already has both. It still must be something else.

When i compile my site it creates the following url:
http://localhost:3341/frontend/view.aspx
All functions work in this case

But when i surf to http://localhost/frontend/view.aspx (as on a regular webserver) it does work, but only until i get to the function that adds a doc to the Word-file.
0
 
Sammy AgeilCommented:
Permit asp.net to Read/Write/Modify the location where the document will be stored on your webserver


0
 
secuteamersAuthor Commented:
how can i permit asp.net to do this? This is not a defined user or group. I have permitted the internetguestaccount to do this, but no success.
0
 
Irwin SantosComputer Integration SpecialistCommented:
list the permissions that you have for admin AND the guest user
0
 
secuteamersAuthor Commented:
can i find these permissions in the Computer Management?
I have following user-accounts:
- Administrator
- ASPNET
- Guest (disabled)
- IUSR_MACHINE
- IWAM_MACHINE

What do i do next?
I guess i'm almost at the solution?
0
 
Irwin SantosComputer Integration SpecialistCommented:
NTFS permissions on the folder need to be set.  I'm not sure how you're authenticating but the account that you are using must have
READ/MODIFY/WRITE

on the folder... go to MY COMPUTER, right click on the folder you want to save your Word Document to, then select the user & permissions

Within IIS, you will pretty much do the same thing.... locate the folder in your website, right click and choose the account.. apply the same permissions.
0
 
Sammy AgeilCommented:
>
I have following user-accounts:
- Administrator
- ASPNET ---->This is the account you need to grant permission to read/write/modify for the folder you plan to create your documents in
- Guest (disabled)
- IUSR_MACHINE
- IWAM_MACHINE
>
best way to do it is this

Go to the folder where you want your document saved, right click and go to properties, go to the Security Tab, Click on Add, Click on Advanced, Click on Find now,Click on ASPNET and click OK and in the allow section check Modify, Read, write, Read and execute, click Ok and you and now you have it set.

HTH
0
 
secuteamersAuthor Commented:
i have given fullcontrol to the aspnet user to the whole project folder and done the same in IIS, but still no solution.
I've added the aspnet user to the administrator group, and with success, but i can keep this situation because of the security leak, right.

Any suggestions?
0
 
secuteamersAuthor Commented:
by the way: the error that i'm getting is:

"Insufficient memory. Save the document now." -> freely translated from my own language. (Dutch)
0
 
Irwin SantosComputer Integration SpecialistCommented:
put this in your code as your 1st & 2nd lines in your .asp file
<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

go into IE- TOOLS-INTERNET OPTIONS, ADVANCE tab, then locate and UNCHECK "SHOW FRIENDLY HTTP ERROR MESSAGES"

Run the code

post back the exact error please
0
 
secuteamersAuthor Commented:
it's a c# file. So why use vbscript?
0
 
secuteamersAuthor Commented:
this is my error page:

"Er is onvoldoende geheugen. Sla het document nu op. " (meaning: Insufficient memory. Save the document now"

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Er is onvoldoende geheugen. Sla het document nu op.

Source Error:


Line 49:         //oWord.Activate();
Line 50:
Line 51:         oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
Line 52:         //oDoc.Activate();
Line 53:
 

Source File: c:\Inetpub\wwwroot\btech\questionnaire\App_Code\open_word.cs    Line: 51

Stack Trace:


[COMException (0x800a13e9): Er is onvoldoende geheugen. Sla het document nu op.]
   Word.Documents.Add(Object& Template, Object& NewTemplate, Object& DocumentType, Object& Visible) +0
   open_word.start_doc(ArrayList prodarray, String filepath, String mylang) in c:\Inetpub\wwwroot\btech\questionnaire\App_Code\open_word.cs:51
   _Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\btech\questionnaire\view.aspx.cs:303
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

 
0
 
Sammy AgeilCommented:
Unfortunately I cant read nor speak Dutch, specially at this time of day :-)
If you take a look here you will see a complete working example on how to open, save and create word documents and templates
http://www.codeproject.com/aspnet/wordapplication.asp

just dont forget to call  System.GC.Collect() after you release your memory to avoid memory leak.

HTH
0
 
Irwin SantosComputer Integration SpecialistCommented:
"it's a c# file. So why use vbscript?"....sorry missed your earlier comment mentioning c#
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 9
  • 7
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now