473,326 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Granting ASP.NET write access to a file

Hi

I'm trying to create a web form that will print a MS Word doc from the web form. I'm using VB.net.

This is the code example

Dim WordApp As New Word.Applicati
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
Dim thisDoc As New Word.Documen
thisDoc = WordApp.Documents.Ad
With thisDo
.Range.InsertAfter("Printing with Word"
.Paragraphs.Item(1).Range.Font.Bold = Tru
.Paragraphs.Item(1).Range.Font.Size = 1
.Range.InsertParagraphAfter(
.Paragraphs.Item(2).Range.Font.Bold = Fals
.Paragraphs.Item(2).Range.Font.Size = 1
.Range.InsertAfter("This is the first line of the test printout"
.Range.InsertParagraphAfter(
.Range.InsertAfter("and this is the second line of the test printout"
Tr
.PrintOut(True, True
Catch ex As Exceptio
MsgBox(ex.Message
End Tr
End Wit
WordApp.Quit(
End Su

It works when I run this in a Windows Application but when I run it in a webform I get an error that say's "ASP.NET is not authorized to access the requested resource

Then it tells me "To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

I've tried this but there is no security tab in the properties page for MS Word, or for .doc file

In the past I've granted ASP.NET access to SQL server through the Enterprise Manager but i can't find anything like that for word

Does anyone know how Grant ASP.NET Access to MSword or other Office Components

Thank Yo

Tom C

Nov 18 '05 #1
6 7769
It sounds like you're using Windows XP.
To enable the security tab you must disable simple file sharing.
To do this, open any windows explorer window and choose Folder Options from
the Tools dropdown menu.
Then go to the View tab.
Scroll to the bottom of the list and uncheck the Use Simple File Sharing
checkbox and click the OK button.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Tom C." <an*******@discussions.microsoft.com> wrote in message
news:2D**********************************@microsof t.com...
Hi,

I'm trying to create a web form that will print a MS Word doc from the web form. I'm using VB.net.
This is the code example:

Dim WordApp As New Word.Applicatio
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim thisDoc As New Word.Document
thisDoc = WordApp.Documents.Add
With thisDoc
.Range.InsertAfter("Printing with Word")
.Paragraphs.Item(1).Range.Font.Bold = True
.Paragraphs.Item(1).Range.Font.Size = 14
.Range.InsertParagraphAfter()
.Paragraphs.Item(2).Range.Font.Bold = False
.Paragraphs.Item(2).Range.Font.Size = 12
.Range.InsertAfter("This is the first line of the test printout") .Range.InsertParagraphAfter()
.Range.InsertAfter("and this is the second line of the test printout") Try
.PrintOut(True, True)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End With
WordApp.Quit()
End Sub
It works when I run this in a Windows Application but when I run it in a webform I get an error that say's "ASP.NET is not authorized to access the
requested resource"
Then it tells me "To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click
"Add" to add the appropriate user or group. Highlight the ASP.NET account,
and check the boxes for the desired access."
I've tried this but there is no security tab in the properties page for MS Word, or for .doc files
In the past I've granted ASP.NET access to SQL server through the Enterprise Manager but i can't find anything like that for word.
Does anyone know how Grant ASP.NET Access to MSword or other Office Components?
Thank You

Tom C.

Nov 18 '05 #2
Thanks Stev

That worked, but I'm still having problem after problem getting this code to run
I'm using VS Studio 2003, IIS 5.1, and Office 97. Would you recommend upgrading somethin
or should I just keep plugging away

Tom
Nov 18 '05 #3
I'm glad that worked.
So what is the new problem you're having?

--
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Tom C." <an*******@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com...
Thanks Steve

That worked, but I'm still having problem after problem getting this code to run. I'm using VS Studio 2003, IIS 5.1, and Office 97. Would you recommend upgrading something or should I just keep plugging away?

Tom

Nov 18 '05 #4
O.K

After I set winword to have access from ASPNET I went back and opened Visual Studio to try my web application but the web app wouldn't open because It said that IIS was not running. So I went into Administrative tools and double clicked the IIS Icon, but nothing happened. Then I tried to unload and reload IIS, but the computer kept freezing; I rebooted several times and tried again. Then I reformated the drive and loaded Windows XP from scratch, and then IIS. It worked fine. then I installed Visual Studio and tried to open a webApplication, it didn't open so I went to Administrative tools and Double clicked the IIS Icon, and nothing happened, and the computer freezes if I try to uninstall IIS

Tom
Nov 18 '05 #5
Yikes, that sounds like a hairy problem.
Is it just one particular web application that it refuses to open? Will it
open any other web applications?
If IIS won't run then clearly ASP.NET isn't going to run.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Tom C." <an*******@discussions.microsoft.com> wrote in message
news:57**********************************@microsof t.com...
O.K.

After I set winword to have access from ASPNET I went back and opened Visual Studio to try my web application but the web app wouldn't open
because It said that IIS was not running. So I went into Administrative
tools and double clicked the IIS Icon, but nothing happened. Then I tried to
unload and reload IIS, but the computer kept freezing; I rebooted several
times and tried again. Then I reformated the drive and loaded Windows XP
from scratch, and then IIS. It worked fine. then I installed Visual Studio
and tried to open a webApplication, it didn't open so I went to
Administrative tools and Double clicked the IIS Icon, and nothing happened,
and the computer freezes if I try to uninstall IIS.
Tom

Nov 18 '05 #6
I had similar situation. Not exactly as you described but weird thing
started to happen when i gave permissions to run Excel from ASP.NET using
dcomcnfg.

I hope this link will help you
http://support.microsoft.com/default...;en-us;Q274696

George.

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:Oc**************@tk2msftngp13.phx.gbl...
Yikes, that sounds like a hairy problem.
Is it just one particular web application that it refuses to open? Will it open any other web applications?
If IIS won't run then clearly ASP.NET isn't going to run.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Tom C." <an*******@discussions.microsoft.com> wrote in message
news:57**********************************@microsof t.com...
O.K.

After I set winword to have access from ASPNET I went back and opened Visual Studio to try my web application but the web app wouldn't open
because It said that IIS was not running. So I went into Administrative
tools and double clicked the IIS Icon, but nothing happened. Then I tried

to unload and reload IIS, but the computer kept freezing; I rebooted several
times and tried again. Then I reformated the drive and loaded Windows XP
from scratch, and then IIS. It worked fine. then I installed Visual Studio
and tried to open a webApplication, it didn't open so I went to
Administrative tools and Double clicked the IIS Icon, and nothing happened, and the computer freezes if I try to uninstall IIS.

Tom


Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DC_DBA | last post by:
I want to 'grant sysdba to a user' for an application. (At least that is what I believe so far after having had this problem dumped on me 2 days ago.) The support we get from the application vendor...
2
by: Ted | last post by:
How do I grant all privileges for a schema that has a large number of existing tables, procedures, functions, etc to a newly created role, without having to issue a grant statement for each object...
3
by: Tim Werth | last post by:
I have a Windows Service that is running as an administrator account. Some of it methods create files for a COM+ client to digest and puts them in C:\Documents and Settings\All Users\Application...
2
by: Prasad Patil | last post by:
hi, I have a ASP.NET / C# web based intranet application, i need to create excel files on the server in the folder. I always get a access denied error from the web application on the server. The...
2
by: LazyAnt | last post by:
Hello, I have DB2 v8.1 for Linux for a class environment; each user has his/her own database as dbadm and they are suppose to study queries from another database. They have the right...
0
by: Charles A. Lackman | last post by:
Hello, I have a web site that is supose to create an Excel file out of a dataset. In my code where: "Dim Excel as new Excel.Application" is placed I receive the following exception: ...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
5
by: news | last post by:
I've a PHP script that is supposed to write results to a file using INTO OUTFILE, but it's not. The mysql_error says: Could not write file: Can't create/write to file...
1
by: =?Utf-8?B?R2FuZXNoIE11dGh1dmVsdQ==?= | last post by:
Hello All, Our application write logs to a file in a folder. Before our application starts writing to that file, I want to check if the current user has write access to that file, for example,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.