pass data to a text file! What this error means?

Discussion in 'ASP .Net' started by sympatico, Feb 7, 2005.

  1. sympatico

    sympatico Guest

    hi, pls help me slove this problem. i am a newbie in using asp.net and SQL
    server 2000 and my problem for now is to pass data to a textfile and i have
    fail to do so.

    the way i did it was i used a datagrid to display certain data for the user
    to choose, as they check the checkbox beside the data, the data shall be
    store into a text file. therefore, i wrote this

    oWrite = oFile.CreateText("C:\Inetpub\wwwroot\VolunteerMatch\tempstore.txt")
    oWrite.WriteLine(Request.Form("mycheckboxgroup"))
    oWrite.Close()

    but in the end, it shows the error like this


    Exception Details: System.UnauthorizedAccessException: Access to the path
    "C:\Inetpub\wwwroot\VolunteerMatch\tempstore.txt" is denied.

    ASP.NET is not authorized to access the requested resource. Consider
    granting access rights to the resource to the ASP.NET request identity.
    ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
    Network Service on IIS 6) that is used if the application is not
    impersonating. If the application is impersonating via <identity
    impersonate="true"/>, the identity will be the anonymous user (typically
    IUSR_MACHINENAME) or the authenticated request user.

    To grant ASP.NET write access to a file, right-click the file in Explorer,
    choose "Properties" and select the Security tab. Click "Add" to add the
    appropriate user or group. Highlight the ASP.NET account, and check the
    boxes for the desired access

    i do not really know wat this means, could you please help me solve this
    problem? and can u please suggest me how to trigger searching capability?
    can i use the data in the text file to trigger search with other database
    data, so that certain data can be find out as a search result?

    pls help, i need advice~~!!
    sympatico, Feb 7, 2005
    #1
    1. Advertising

  2. sympatico wrote:
    > To grant ASP.NET write access to a file, _right-click the file in Explorer,
    > choose "Properties" and select the Security tab. Click "Add" to add the
    > appropriate user or group. Highlight the ASP.NET account, and check the
    > boxes for the desired access_
    >


    Just grant write access for Network Service to the "VolunteerMatch"
    folder. This is not secure, I think.

    GK
    Grzegorz Kaczor, Feb 7, 2005
    #2
    1. Advertising

  3. sympatico

    Hans Kesting Guest

    sympatico wrote:
    > hi, pls help me slove this problem. i am a newbie in using asp.net and SQL
    > server 2000 and my problem for now is to pass data to a textfile and i have
    > fail to do so.
    >
    > the way i did it was i used a datagrid to display certain data for the user
    > to choose, as they check the checkbox beside the data, the data shall be
    > store into a text file. therefore, i wrote this
    >
    > oWrite = oFile.CreateText("C:\Inetpub\wwwroot\VolunteerMatch\tempstore.txt")
    > oWrite.WriteLine(Request.Form("mycheckboxgroup"))
    > oWrite.Close()
    >
    > but in the end, it shows the error like this
    >
    >
    > Exception Details: System.UnauthorizedAccessException: Access to the path
    > "C:\Inetpub\wwwroot\VolunteerMatch\tempstore.txt" is denied.
    >
    > ASP.NET is not authorized to access the requested resource. Consider
    > granting access rights to the resource to the ASP.NET request identity.
    > ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
    > Network Service on IIS 6) that is used if the application is not
    > impersonating. If the application is impersonating via <identity
    > impersonate="true"/>, the identity will be the anonymous user (typically
    > IUSR_MACHINENAME) or the authenticated request user.
    >
    > To grant ASP.NET write access to a file, right-click the file in Explorer,
    > choose "Properties" and select the Security tab. Click "Add" to add the
    > appropriate user or group. Highlight the ASP.NET account, and check the
    > boxes for the desired access
    >
    > i do not really know wat this means, could you please help me solve this
    > problem? and can u please suggest me how to trigger searching capability?
    > can i use the data in the text file to trigger search with other database
    > data, so that certain data can be find out as a search result?
    >
    > pls help, i need advice~~!!
    >
    >


    1) if you didn't already know it, asp.net works on the server,
    so will write on the server, not on the client.
    2) asp.net runs under it's own account, with very few permissions.
    (ASPNET on XP, something like NETWORK_SERVICE on win2003).
    this account can't write to the filesystem, unless you
    specifically grant write-access on the specific directory
    you want to write to.
    3) writing to a file is usually not a good choice for a webserver:
    what if two (or more) users cause your site to write to that file
    at the same time?

    what do you mean by "search with other database"?

    --
    Hans Kesting
    Hans Kesting, Feb 8, 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. ronaldlee
    Replies:
    3
    Views:
    3,562
    Hans Kesting
    Dec 16, 2004
  2. sympatico
    Replies:
    1
    Views:
    352
    Patrick Steele [MVP]
    Jan 23, 2005
  3. sympatico
    Replies:
    0
    Views:
    296
    sympatico
    Feb 7, 2005
  4. Elaine Jackson

    'telegraphy' as a means of data entry

    Elaine Jackson, Sep 11, 2004, in forum: Python
    Replies:
    11
    Views:
    475
    Jeff Epler
    Sep 13, 2004
  5. mahesh
    Replies:
    2
    Views:
    1,673
    Ian Collins
    May 17, 2007
Loading...

Share This Page