Local Drive File Permissions

Discussion in 'ASP .Net Web Services' started by Brandon, Sep 20, 2005.

  1. Brandon

    Brandon Guest

    Sorry for the cross post. I posted this in web services general, but after
    thinking about it, I think it will get more hits here in asp.net web
    services. I'm on Windows XP Pro running a web service on my local pc (which
    will eventually be moved up to a server). I need to access several files on
    my local hard drive (ultimately the server's hard drive) from the web
    service. I'm running into a file access problem with this. To illustrate my
    problem, I've got it really stripped down. Here is a web service in c# ...

    using System.IO;
    ....
    [WebMethod]
    public string OpenFile()
    {
    string retVal = "OK";
    try
    {
    FileStream fs = new FileStream("c:\\hello.txt", FileMode.Open);
    }
    catch ( Exception e )
    {
    retVal = e.Message;
    }
    return retVal;
    }

    When I browse to this service in IE and Invoke the OpenFile method, my
    return value is "Access to the path "c:\hello.txt" is denied."

    I've tried changing my IUSR_BRANDON user to be a member of the Administrator
    group. I've changed the anonymous access user to Administrator. Let IIS
    control password as well as type it in explicitly. I've fooled around with
    several things, but nothing I change or flip seems to have any effect.

    This should be pretty easy shouldn't it? I mean, the asp.net process should
    be able to see the local drive right? Any help will be greatly appreciated.
    I'm beating my head on the keyboard here.

    Thanks is advance,
    Brandon Parks
    (remove spamfree)
    Brandon, Sep 20, 2005
    #1
    1. Advertising

  2. Brandon

    Luca Morelli Guest

    if i remember well there is an ASPNET user that is used by the asp.net
    processes.
    I suggest that if you want less problems read froma directory with
    FullAccess to everyone rights.

    "Brandon" <> ha scritto nel messaggio
    news:...
    > Sorry for the cross post. I posted this in web services general, but after
    > thinking about it, I think it will get more hits here in asp.net web
    > services. I'm on Windows XP Pro running a web service on my local pc
    > (which
    > will eventually be moved up to a server). I need to access several files
    > on
    > my local hard drive (ultimately the server's hard drive) from the web
    > service. I'm running into a file access problem with this. To illustrate
    > my
    > problem, I've got it really stripped down. Here is a web service in c# ...
    >
    > using System.IO;
    > ...
    > [WebMethod]
    > public string OpenFile()
    > {
    > string retVal = "OK";
    > try
    > {
    > FileStream fs = new FileStream("c:\\hello.txt", FileMode.Open);
    > }
    > catch ( Exception e )
    > {
    > retVal = e.Message;
    > }
    > return retVal;
    > }
    >
    > When I browse to this service in IE and Invoke the OpenFile method, my
    > return value is "Access to the path "c:\hello.txt" is denied."
    >
    > I've tried changing my IUSR_BRANDON user to be a member of the
    > Administrator
    > group. I've changed the anonymous access user to Administrator. Let IIS
    > control password as well as type it in explicitly. I've fooled around with
    > several things, but nothing I change or flip seems to have any effect.
    >
    > This should be pretty easy shouldn't it? I mean, the asp.net process
    > should
    > be able to see the local drive right? Any help will be greatly
    > appreciated.
    > I'm beating my head on the keyboard here.
    >
    > Thanks is advance,
    > Brandon Parks
    > (remove spamfree)
    >
    Luca Morelli, Sep 20, 2005
    #2
    1. Advertising

  3. I would not give FullAccess to Everyone. Its not secure..
    You can try adding IIS_WPG to the user names and that should solve it.

    If it doesnt work...give access to "Network Service" and try it.

    -- Kumar Shetgar


    "Luca Morelli" wrote:

    > if i remember well there is an ASPNET user that is used by the asp.net
    > processes.
    > I suggest that if you want less problems read froma directory with
    > FullAccess to everyone rights.
    >
    > "Brandon" <> ha scritto nel messaggio
    > news:...
    > > Sorry for the cross post. I posted this in web services general, but after
    > > thinking about it, I think it will get more hits here in asp.net web
    > > services. I'm on Windows XP Pro running a web service on my local pc
    > > (which
    > > will eventually be moved up to a server). I need to access several files
    > > on
    > > my local hard drive (ultimately the server's hard drive) from the web
    > > service. I'm running into a file access problem with this. To illustrate
    > > my
    > > problem, I've got it really stripped down. Here is a web service in c# ...
    > >
    > > using System.IO;
    > > ...
    > > [WebMethod]
    > > public string OpenFile()
    > > {
    > > string retVal = "OK";
    > > try
    > > {
    > > FileStream fs = new FileStream("c:\\hello.txt", FileMode.Open);
    > > }
    > > catch ( Exception e )
    > > {
    > > retVal = e.Message;
    > > }
    > > return retVal;
    > > }
    > >
    > > When I browse to this service in IE and Invoke the OpenFile method, my
    > > return value is "Access to the path "c:\hello.txt" is denied."
    > >
    > > I've tried changing my IUSR_BRANDON user to be a member of the
    > > Administrator
    > > group. I've changed the anonymous access user to Administrator. Let IIS
    > > control password as well as type it in explicitly. I've fooled around with
    > > several things, but nothing I change or flip seems to have any effect.
    > >
    > > This should be pretty easy shouldn't it? I mean, the asp.net process
    > > should
    > > be able to see the local drive right? Any help will be greatly
    > > appreciated.
    > > I'm beating my head on the keyboard here.
    > >
    > > Thanks is advance,
    > > Brandon Parks
    > > (remove spamfree)
    > >

    >
    >
    >
    Kumar Shetgar, Oct 6, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon
    Replies:
    5
    Views:
    11,157
    Scott M.
    Jan 17, 2010
  2. Replies:
    3
    Views:
    525
    Paul Clement
    Sep 12, 2005
  3. mh
    Replies:
    4
    Views:
    700
    Wolfgang Strobl
    May 31, 2005
  4. Tom Anderson
    Replies:
    8
    Views:
    393
    Gerrit Holl
    Sep 15, 2005
  5. shailesh
    Replies:
    1
    Views:
    779
    Tim Golden
    Mar 28, 2007
Loading...

Share This Page