473,513 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Writing a File from a Web Service

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?

--
Thanks,

Bill Manring
Wavefront Software, Inc.
Feb 16 '07 #1
4 1628
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

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Bill Manring" wrote:
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?

--
Thanks,

Bill Manring
Wavefront Software, Inc.
Feb 16 '07 #2
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.
"Peter Bromberg [C# MVP]" wrote:
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

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Bill Manring" wrote:
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?

--
Thanks,

Bill Manring
Wavefront Software, Inc.
Feb 16 '07 #3
protected void Page_Load(object sender, System.EventArgs e)
{
Label1.Text = Page.User.Identity.Name +" : "+
Page.User.Identity.AuthenticationType.ToString();

}

Cheers,
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Bill Manring" wrote:
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.
"Peter Bromberg [C# MVP]" wrote:
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

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Bill Manring" wrote:
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?
>
--
Thanks,
>
Bill Manring
Wavefront Software, Inc.
Feb 16 '07 #4
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.
"Peter Bromberg [C# MVP]" wrote:
protected void Page_Load(object sender, System.EventArgs e)
{
Label1.Text = Page.User.Identity.Name +" : "+
Page.User.Identity.AuthenticationType.ToString();

}

Cheers,
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Bill Manring" wrote:
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.
"Peter Bromberg [C# MVP]" wrote:
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
>
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
>
>
>
>
"Bill Manring" wrote:
>
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?

--
Thanks,

Bill Manring
Wavefront Software, Inc.
Feb 16 '07 #5

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

Similar topics

4
3903
by: Mike Woinoski | last post by:
(I'm new to VS, so please forgive me if this is a faq.) I'm writing some Java web services and need to test them with C++ clients. I can use either a Windows Form application or an MFC application....
3
2583
by: Chris Dunaway | last post by:
I am writing a Windows Service that reads and processes files on a set schedule. I want to create a second app that can monitor the Windows service. The Windows service will write trace messages...
1
1468
by: Tommy | last post by:
I have a windows service that has an app config file. I also have a filesystem watcher watching the config file. When the config file changes I am reading the values back into memory. It all...
0
963
by: Stephen | last post by:
Hi, I have created a windows service and I make entries into eventlog as well as created a file for writing "Errors", it ran fine until i observed 2 conditions: 1. sufficient space was not...
7
4024
by: HeatherS | last post by:
We are having issues with our windows services using memory and never releasing it. We have one service that has a file watcher which takes an xml file, inserts some records into a database, and...
5
2202
by: gnanapoongothai | last post by:
hi, i am doing socket programming , and once socket is connected getting data from client and wrting into the file. the file is created but nothing is in it? whats up ? code: WORD...
2
14209
by: Solomon_Man | last post by:
All, I have a Windows Service application that has database connectivity and needs the capability to let a user know that there has been a db failure. What is the proper way to notify a user that...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.