Problem Writing a File from a Web Service

G

Guest

I have an internal ASP.NET 2.0 web service that does, among other things,
expose a method that causes files to be written to a location that the user
configures. The web service has been around for a while, under ASP.NET 1.0
and it has just been updated to ASP.NET 2.0. The functionality in question
has not changed.

When testing the upgraded web service on Windows XP, I got an error when the
file was created:

Access to the path 'C:\MyFolder\myFile.ext' is denied.

This looks like a security issue, so I checked the folder permissions for
the ASPNET user (this is XP) and it had write permissions to the folder. I
tried adding the ASPNET user to the local administrators group on the
machine, to at least confirm that I have a permissions issue - the problem
did not go away.

Finally, I solved the problem by having the web service impersonate my
Windows Domain account. I added a line like the following to the web.config
file:

<identity impersonate="true" userName="domain\myName" password="myPassword" />

This solved the problem, but I don't understand why I had to do this and I
don't want this to be the final solution.

Does anyone understand what is going on?
 
G

Guest

Well, if setting the impersonate element to your domain accout fixed the
problem, then it stands to reason that whatever permission set you granted to
the ASPNET user was insufficient. Either that, or the Webservice isn't
actually running under the ASPNET user credentials.
Peter
 
G

Guest

Peter,

Thanks for the reply. By placing the ASPNET account in the local
Adminstrators group, it should have the same permissions as my Domain account.

That leads me to believe that the web service isn't running under the ASPNET
account, but I have done nothing to force it to be otherwise. How can I tell
which account it is running under?

--
Thanks,

Bill Manring
Wavefront Software, Inc.
 
G

Guest

User.Identity.Name came back as an empty string when I turned off
impersonation. Does that mean it is running as the anonymous user?
--
Thanks,

Bill Manring
Wavefront Software, Inc.
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top