"access denied" error in asp.net application

L

Loane Sharp

Hi there

I'm using VB.NET and Office Web Components to access a SQL Server 2005
Express database and draw pictures on the fly in my ASP.NET application.
Using .ExportPicture to write the GIF/JPEG/PNG image to disk and then load
it into the page using the <IMG /> tag is probably not the tidiest or most
secure way of doing this, but it is the easiest and allows the greatest
flexibility and control. (It also seems to be the most popular
method, judging by the newsgroups.)

However, the parser gives an "Access denied" error message at the line
containing the .ExportPicture command. The same set of code, run on a
different machine, doesn't give this error. I initially assumed that it was
a
security issue related to the application's attempt to write the GIF file to
disk and added all the necessary permissions to the ASPNET account.
(Specifically, from <Control panel> <User accounts> I gave the ASPNET
account write permission on the wwwroot folder and subfolders. From
Windows Explorer, I right-clicked the wwwroot folder, selected Properties
and followed the Security tab to check that the ASPNET account had been
given write permissions on the folder. Following a suggestion in the
ASP.NET newsgroup, I even added the ASPNET account to the Administrators
group to test the theory of a security/permissions issue. I must have tried
at least a dozen other things to get this right, but without success, so it
might
not be a security issue after all.

Someone suggested that it might not have to do with write permissions at
all,
perhaps the component is being used by another process.

I'd greatly appreciate a pointer in the right direction.

Best regards
Loane
 
A

Alvin Bruney - ASP.NET MVP

what i would do is add some code to print the executing process to the
screen. It might not be who you expect it to be. for instance:
windows.identity.name [i'm positve the syntax is incorrect but you get the
picture] if it is the aspnet account you have another problem. if it is not,
provide permissions to the executing process

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
S

Sunny

hey i got same error with pivottable.export function. It says permission
denied. I have tried all possible things but just not able to fix the
problem. Just read this post... Sorry i didnt get what actually has to be
done to make it work... Could you be more presise...

Scenario: My web page has owc 10 pivottable. i have put
pivottable.export("") function on a button click. Now on my machine where i
have developed the applicaitn there is no issue. BUt on other machines i get
this error "Permissin Denied"

Please reply asap....
Its urgent to solve!!!
Thanks n regards!!
 
E

Eliyahu Goldin

Read through this error explanation. It offers you the ways how to solve the
problem.

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET 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.

Eliyahu
 
S

Sunny

hi thanks for the answer.
Now what i found is that in pivottable.export() if i give full path like
this pivottable.export("c:\\inetpub\\wwwroot\\abc\\temp.xsl",1) and set an IE
setting -> "Initialize and script activex control not marked as safe" to
Enable, then there is no problem at all. Now doing this is kinda tedious and
also something my client wouldnt agree upon. Is there any workaround???

and one more thing, this all happened when i had this export funciton on
client side script. and now if i transfer this code to server side in C# then
it creates temp.xls file on server which i really do not want. Also it only
creates the file and does not open it..

plz help!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top