Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem Writing a File from a Web Service

Reply
Thread Tools

Problem Writing a File from a Web Service

 
 
=?Utf-8?B?QmlsbCBNYW5yaW5n?=
Guest
Posts: n/a
 
      02-16-2007
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.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      02-16-2007
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.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmlsbCBNYW5yaW5n?=
Guest
Posts: n/a
 
      02-16-2007
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.

 
Reply With Quote
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      02-16-2007
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.

 
Reply With Quote
 
=?Utf-8?B?QmlsbCBNYW5yaW5n?=
Guest
Posts: n/a
 
      02-16-2007
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Consuming local web service - ok, remote web service -problem? dgleeson422111 ASP .Net Web Controls 0 01-26-2010 11:17 AM
Does timer in Web Service Global.asax block my Web Service from processing web-site requests? Leo Violette ASP .Net Web Services 0 04-17-2009 12:39 AM
Problem: My web service calls only open a single connection to the web service machine Scott Baierl ASP .Net Web Services 1 07-29-2006 01:16 AM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
Any problems with writing the information into a file - Multi-users perform writing the same file at the same time ???? HNguyen ASP .Net 4 12-21-2004 01:53 PM



Advertisments