Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2005

Tip: Looking for answers? Try searching our database.

Opening a remote file from web service code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel P. - 14 Feb 2005 19:43 GMT
I'm using C#:

Stream s = File.Open( @"\remotemachine\share\MyFile.txt"
               , FileMode.Open
               , FileAccess.Read
               , FileShare.Read );

I'm getting the following exception:

"The referenced account is currently locked out and may
not be logged on to."

I'm admin on the remote machine.

Trying on another machine where I'm a simple user I get

"Could not find a part of the path "M:\MyFile.txt"

The file sits on another machine on the network. I change
the account settings in IIS Admin to use my domanin
account instead of the defual one (IUSR_...).

Can anyone point me into the right direction?

Thanks!
Daniel
anonymous@discussions.microsoft.com - 14 Feb 2005 20:03 GMT
I also get

Logon failure: unknown user name or bad password.

if I use UNC instead of mapped drive.

>-----Original Message-----
>I'm using C#:
[quoted text clipped - 25 lines]
>
>.
Keenan Newton - 14 Feb 2005 20:22 GMT
Well my first suggestion is to always  use a UNC.  mapped drives are
just an easy way for "humans" to get to network reources.  When you
logon your computer your mapped drives are mapped for you each time you
logon, but when you logon as a service this mapping does not take
place.  So use UNCs always.  Another thing I would do is use
impersonation with the web service / web application to it will
impersonate the account calling the web service or web application.
Thus that users credientials are also used for retrieving the file
Daniel P. - 14 Feb 2005 20:32 GMT
Good point! Thanks!
But this time I get

"Logon failure: unknown user name or bad password."

Daniel

>-----Original Message-----
>Well my first suggestion is to always  use a UNC.  mapped drives are
[quoted text clipped - 7 lines]
>
>.
Eric Giles - 15 Feb 2005 01:37 GMT
Are you hosting the service on a Windows 2003 server?

Apparently there are some issues with Windows 2003 when trying to
impersonate a user to a remote resource. We stumbled across a similar issue
when using SQL Reporting Services hosted on Windows 2003. We reinstalled the
entire reporting environment onto a Windows 2000 Server and the problem
immediately disappeared. These issues related to security problems access
resources on remote machines via a web application.

If you have access to a Windows 2000 server and you are currently using a
Windows 2003 server, this may be worth testing.

- Eric Giles

> I'm using C#:
>
[quoted text clipped - 22 lines]
> Thanks!
> Daniel

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.