473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Unable to write files to the server.

cur
Ok, I need some help here. First of all, here's the offending bit of code

Private Sub WriteToFile(ByVal strPath As String, ByRef buffer As Byte()
Dim newFile As System.IO.FileStream = New System.IO.FileStream(strPath, System.IO.FileMode.Create, IO.FileAccess.Write

newFile.Write(buffer, 0, buffer.Length

newFile.Close(
End Su

I don't think it's the code, but there it is, just for reference.

Second, here is the error I'm getting

Access to the path "C:\Mypath" is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path "C:\Mypath" 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

What I've done

Absolutely everything. I have tried everything I could think of from adding aspnet to the admin group to hunting through gpedit.msc to find anything even remotely relevant. I have found a few people that said the took steps 1,2 and 3, which I did, and it didn't work. Besides, the web share idea scares me. I've messed with every permission I could find for any user regarding this directory and under no circumstances will it allow me to write to the server

Please, any ideas?

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
Nov 18 '05 #1
3 1401
What OS are you running under? Also, are you enabling impersonation in the
web.config file?

--
- Paul Glavich
Microsoft MVP - ASP.NET
"cur" <curt_h_@-NOSPAM-hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
Ok, I need some help here. First of all, here's the offending bit of code:

Private Sub WriteToFile(ByVal strPath As String, ByRef buffer As Byte()) Dim newFile As System.IO.FileStream = New System.IO.FileStream(strPath, System.IO.FileMode.Create,
IO.FileAccess.Write)
newFile.Write(buffer, 0, buffer.Length)

newFile.Close()
End Sub

I don't think it's the code, but there it is, just for reference.

Second, here is the error I'm getting:

Access to the path "C:\Mypath" is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path "C:\Mypath" 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.
What I've done:

Absolutely everything. I have tried everything I could think of from adding aspnet to the admin group to hunting through gpedit.msc to find
anything even remotely relevant. I have found a few people that said the
took steps 1,2 and 3, which I did, and it didn't work. Besides, the web
share idea scares me. I've messed with every permission I could find for any
user regarding this directory and under no circumstances will it allow me to
write to the server.
Please, any ideas?

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/

Nov 18 '05 #2
Are you sure you're granting permission to the right user account?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"cur" <curt_h_@-NOSPAM-hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
Ok, I need some help here. First of all, here's the offending bit of code:

Private Sub WriteToFile(ByVal strPath As String, ByRef buffer As Byte()) Dim newFile As System.IO.FileStream = New System.IO.FileStream(strPath, System.IO.FileMode.Create,
IO.FileAccess.Write)
newFile.Write(buffer, 0, buffer.Length)

newFile.Close()
End Sub

I don't think it's the code, but there it is, just for reference.

Second, here is the error I'm getting:

Access to the path "C:\Mypath" is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path "C:\Mypath" 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.
What I've done:

Absolutely everything. I have tried everything I could think of from adding aspnet to the admin group to hunting through gpedit.msc to find
anything even remotely relevant. I have found a few people that said the
took steps 1,2 and 3, which I did, and it didn't work. Besides, the web
share idea scares me. I've messed with every permission I could find for any
user regarding this directory and under no circumstances will it allow me to
write to the server.
Please, any ideas?

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/

Nov 18 '05 #3
cur
Well, this is happening on both my XP dev machine (where I'm sitting now) and my win2k server. Both are NTFS, I believe

I have tried setting the permissions for the aspnet user, User system account, IUSR_MACHINENAME account and even for laughs, the IWAM_MACHINENAME account. I have added all the above to the admin group (since removed), adjusted web sharing, folder perms, tried to share the folder any way I could and it just doesn't want to allow write access. Read access is still ok as the app can still access what's in that directory

No, I haven't tried to impersonate a user in the machine.config file. I'm not exactly sure how I feel about that as it will effect all app's running on that server. I'm open to suggestions or explanations on impersonating user's in this context.

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I'm probably missing something obvious, but I'm unable to write a file with this function. I've used my FTP software to set permissions to 777 on all the files in question. I've tried r, r+, w, and...
1
by: Joel Finkel | last post by:
Folks, I am unable to execute any ASPX files on a Windows 2000 Server, running as a Primary Domain Controller. The error is "Error BC31019: Unable to write to output file '<filename>'" By...
0
by: Marc Speed | last post by:
I have a windows server 2003 machine that cannot run any aspx pages. The pages are created on my XP machine and run fine on two other servers but this server keeps giving me the following error: ...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
2
by: ykgoh | last post by:
Hi. I've a problem of being able to create and remove a directory but unable to write a file inside the created directory for some strange reason. I suspect that this problem could be vaguely...
7
by: Jed | last post by:
I am trying to open web project in VS 2003 using the File Share method. VS is running on XP Pro (Host) and I am accessing the root web of an XP Pro install on Virtual PC (Server) running on the...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
0
by: nimjerry | last post by:
i am using db2 udb V 9 on aix 5.3 and in db2diag.log alwas has this error occurr below is sample message 2008-03-03-09.45.34.366406+420 I306667A443 LEVEL: Warning PID : 835622 ...
0
by: ll | last post by:
I'm working with 'pure ASP upload' script which is designed to redirect to an alert/error message, should a file larger than the set limit be attempted to be uploaded. The problem is that, while...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.