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

S

sympatico

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~~!!
 
G

Grzegorz Kaczor

sympatico said:
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
 
H

Hans Kesting

sympatico said:
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"?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top