473,651 Members | 2,835 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET doesn't have permission to access resource

The computer: W2K server, domain controller, Microsoft.Net Framework 1.1

=============== =========
The error message:

Access to the path "c:\fanmail\new files" is denied
....

Exception Details: System.Unauthor izedAccessExcep tion: Access to the path
"c:\fanmail\new files" is denied

*(see below for Stack Trace)

=============== =========

Fixes tried (but didn't work):

1. Added ASPNET account to c:\fanmail\newf iles and granted full permission
to resource;

2. Added ASPNET to Administrator group;

3. Changed machine.config processModel username setting to "SYSTEM";

4. Changed machine.config processModel username setting to "{Domain}\ASPNE T"
along with the password setting to the appropriate password;

5. Sacrificed three chickens and a goat (in theory).

=============== ========

Most of the articles I've read say it's simply a permissions problem, like
the error reports. But it doesn't seem that any kind of permission changing
on the resource works. Anything else I should try?

Thanks for any help!

--Brent

----------------------------------------------------------------------------
-
The code class giving me the problems (from clsFTP, downloaded from
someplace on the Web)

=============== =============== =====
Public Sub DownloadFile(By Val sFileName As String, _
ByVal sLocalFileName As String, _
ByVal bResume As Boolean)
Dim st As Stream
Dim output As FileStream
Dim cSocket As Socket
Dim offset, npos As Long

If (Not (m_bLoggedIn)) Then
Login()
End If

SetBinaryMode(T rue)

If (sLocalFileName .Equals("")) Then
sLocalFileName = sFileName
End If

If (Not (File.Exists(sL ocalFileName))) Then
st = File.Create(sLo calFileName) '<----Error here, I presume
st.Close()
End If

output = New FileStream(sLoc alFileName, FileMode.Open)
cSocket = CreateDataSocke t()
offset = 0

If (bResume) Then
offset = output.Length

If (offset > 0) Then
SendCommand("RE ST " & offset)
If (m_iRetValue <> 350) Then
'throw new IOException(rep ly.Substring(4) );
'Some servers may not support resuming.
offset = 0
End If
End If

If (offset > 0) Then
npos = output.Seek(off set, SeekOrigin.Begi n)
End If
End If

SendCommand("RE TR " & sFileName)

If (Not (m_iRetValue = 150 Or m_iRetValue = 125)) Then
MessageString = m_sReply
Throw New IOException(m_s Reply.Substring (4))
End If

Do While (True)
m_aBuffer.Clear (m_aBuffer, 0, m_aBuffer.Lengt h)
m_iBytes = cSocket.Receive (m_aBuffer, m_aBuffer.Lengt h, 0)
output.Write(m_ aBuffer, 0, m_iBytes)

If (m_iBytes <= 0) Then
Exit Do
End If
Loop

output.Close()
If (cSocket.Connec ted) Then
cSocket.Close()
End If

ReadReply()
If (Not (m_iRetValue = 226 Or m_iRetValue = 250)) Then
MessageString = m_sReply
Throw New IOException(m_s Reply.Substring (4))
End If

End Sub
=============== ============

Stack Trace:

[UnauthorizedAcc essException: Access to the path "c:\FanMail\New Files" is
denied.]
System.IO.__Err or.WinIOError(I nt32 errorCode, String str) +393
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean
bFromProxy) +888
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize) +44
clsFTP.Download File(String sFileName, String sLocalFileName, Boolean
bResume) +120
clsFTP.Download File(String sFileName, String sLocalFileName) +13
ASP.test_aspx.P age_Load() in C:\ClientsWeb\t est.aspx:20
System.Web.Util .ArglessEventHa ndlerDelegatePr oxy.Callback(Ob ject sender,
EventArgs e) +10
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +731
Nov 18 '05 #1
4 1742
Have you given the IUSR_<MachineNa me> account access to the folder? Had a
similar issue not to long ago, seems that the ASPNet account isn't enough
and wound up having to give access to the folder to the IUSR_<MachineNa me>
account.

"Brent Bigler" <bb*****@yahoo. com> wrote in message
news:uS******** ******@tk2msftn gp13.phx.gbl...
The computer: W2K server, domain controller, Microsoft.Net Framework 1.1

=============== =========
The error message:

Access to the path "c:\fanmail\new files" is denied
...

Exception Details: System.Unauthor izedAccessExcep tion: Access to the path
"c:\fanmail\new files" is denied

*(see below for Stack Trace)

=============== =========

Fixes tried (but didn't work):

1. Added ASPNET account to c:\fanmail\newf iles and granted full permission
to resource;

2. Added ASPNET to Administrator group;

3. Changed machine.config processModel username setting to "SYSTEM";

4. Changed machine.config processModel username setting to "{Domain}\ASPNE T" along with the password setting to the appropriate password;

5. Sacrificed three chickens and a goat (in theory).

=============== ========

Most of the articles I've read say it's simply a permissions problem, like
the error reports. But it doesn't seem that any kind of permission changing on the resource works. Anything else I should try?

Thanks for any help!

--Brent

-------------------------------------------------------------------------- -- -
The code class giving me the problems (from clsFTP, downloaded from
someplace on the Web)

=============== =============== =====
Public Sub DownloadFile(By Val sFileName As String, _
ByVal sLocalFileName As String, _
ByVal bResume As Boolean)
Dim st As Stream
Dim output As FileStream
Dim cSocket As Socket
Dim offset, npos As Long

If (Not (m_bLoggedIn)) Then
Login()
End If

SetBinaryMode(T rue)

If (sLocalFileName .Equals("")) Then
sLocalFileName = sFileName
End If

If (Not (File.Exists(sL ocalFileName))) Then
st = File.Create(sLo calFileName) '<----Error here, I presume
st.Close()
End If

output = New FileStream(sLoc alFileName, FileMode.Open)
cSocket = CreateDataSocke t()
offset = 0

If (bResume) Then
offset = output.Length

If (offset > 0) Then
SendCommand("RE ST " & offset)
If (m_iRetValue <> 350) Then
'throw new IOException(rep ly.Substring(4) );
'Some servers may not support resuming.
offset = 0
End If
End If

If (offset > 0) Then
npos = output.Seek(off set, SeekOrigin.Begi n)
End If
End If

SendCommand("RE TR " & sFileName)

If (Not (m_iRetValue = 150 Or m_iRetValue = 125)) Then
MessageString = m_sReply
Throw New IOException(m_s Reply.Substring (4))
End If

Do While (True)
m_aBuffer.Clear (m_aBuffer, 0, m_aBuffer.Lengt h)
m_iBytes = cSocket.Receive (m_aBuffer, m_aBuffer.Lengt h, 0)
output.Write(m_ aBuffer, 0, m_iBytes)

If (m_iBytes <= 0) Then
Exit Do
End If
Loop

output.Close()
If (cSocket.Connec ted) Then
cSocket.Close()
End If

ReadReply()
If (Not (m_iRetValue = 226 Or m_iRetValue = 250)) Then
MessageString = m_sReply
Throw New IOException(m_s Reply.Substring (4))
End If

End Sub
=============== ============

Stack Trace:

[UnauthorizedAcc essException: Access to the path "c:\FanMail\New Files" is
denied.]
System.IO.__Err or.WinIOError(I nt32 errorCode, String str) +393
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) +44
clsFTP.Download File(String sFileName, String sLocalFileName, Boolean
bResume) +120
clsFTP.Download File(String sFileName, String sLocalFileName) +13
ASP.test_aspx.P age_Load() in C:\ClientsWeb\t est.aspx:20
System.Web.Util .ArglessEventHa ndlerDelegatePr oxy.Callback(Ob ject sender, EventArgs e) +10
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +731

Nov 18 '05 #2
Have you turned on impersonate in .config file? If yes, your web code run
under the the authenticated user of IIS; then you have configured the
Anonymous access you must add the permission for the account configured in
IIS (IUSR_machinena me is the default on II5). Else if you have configured
the basic or windows integrated, you must add the permission for the
requester user.
I think that add a simple code the write the process identity could help you
to troubleshoot what's happens:
Response.Write( "Identity: " +
System.Security .Principal.Wind owsIdentity.Get Current.Name)

HtH,
Andrea

--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Brent Bigler" <bb*****@yahoo. com> wrote in message
news:uS******** ******@tk2msftn gp13.phx.gbl...
The computer: W2K server, domain controller, Microsoft.Net Framework 1.1

=============== =========
The error message:

Access to the path "c:\fanmail\new files" is denied
...

Exception Details: System.Unauthor izedAccessExcep tion: Access to the path
"c:\fanmail\new files" is denied

*(see below for Stack Trace)

=============== =========

Fixes tried (but didn't work):

1. Added ASPNET account to c:\fanmail\newf iles and granted full permission
to resource;

2. Added ASPNET to Administrator group;

3. Changed machine.config processModel username setting to "SYSTEM";

4. Changed machine.config processModel username setting to "{Domain}\ASPNE T" along with the password setting to the appropriate password;

5. Sacrificed three chickens and a goat (in theory).

=============== ========

Most of the articles I've read say it's simply a permissions problem, like
the error reports. But it doesn't seem that any kind of permission changing on the resource works. Anything else I should try?

Thanks for any help!

--Brent

-------------------------------------------------------------------------- -- -
The code class giving me the problems (from clsFTP, downloaded from
someplace on the Web)

=============== =============== =====
Public Sub DownloadFile(By Val sFileName As String, _
ByVal sLocalFileName As String, _
ByVal bResume As Boolean)
Dim st As Stream
Dim output As FileStream
Dim cSocket As Socket
Dim offset, npos As Long

If (Not (m_bLoggedIn)) Then
Login()
End If

SetBinaryMode(T rue)

If (sLocalFileName .Equals("")) Then
sLocalFileName = sFileName
End If

If (Not (File.Exists(sL ocalFileName))) Then
st = File.Create(sLo calFileName) '<----Error here, I presume
st.Close()
End If

output = New FileStream(sLoc alFileName, FileMode.Open)
cSocket = CreateDataSocke t()
offset = 0

If (bResume) Then
offset = output.Length

If (offset > 0) Then
SendCommand("RE ST " & offset)
If (m_iRetValue <> 350) Then
'throw new IOException(rep ly.Substring(4) );
'Some servers may not support resuming.
offset = 0
End If
End If

If (offset > 0) Then
npos = output.Seek(off set, SeekOrigin.Begi n)
End If
End If

SendCommand("RE TR " & sFileName)

If (Not (m_iRetValue = 150 Or m_iRetValue = 125)) Then
MessageString = m_sReply
Throw New IOException(m_s Reply.Substring (4))
End If

Do While (True)
m_aBuffer.Clear (m_aBuffer, 0, m_aBuffer.Lengt h)
m_iBytes = cSocket.Receive (m_aBuffer, m_aBuffer.Lengt h, 0)
output.Write(m_ aBuffer, 0, m_iBytes)

If (m_iBytes <= 0) Then
Exit Do
End If
Loop

output.Close()
If (cSocket.Connec ted) Then
cSocket.Close()
End If

ReadReply()
If (Not (m_iRetValue = 226 Or m_iRetValue = 250)) Then
MessageString = m_sReply
Throw New IOException(m_s Reply.Substring (4))
End If

End Sub
=============== ============

Stack Trace:

[UnauthorizedAcc essException: Access to the path "c:\FanMail\New Files" is
denied.]
System.IO.__Err or.WinIOError(I nt32 errorCode, String str) +393
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) +44
clsFTP.Download File(String sFileName, String sLocalFileName, Boolean
bResume) +120
clsFTP.Download File(String sFileName, String sLocalFileName) +13
ASP.test_aspx.P age_Load() in C:\ClientsWeb\t est.aspx:20
System.Web.Util .ArglessEventHa ndlerDelegatePr oxy.Callback(Ob ject sender, EventArgs e) +10
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +731

Nov 18 '05 #3
Thanks for both your replies!

I added the IUSR account to the resource with no luck. I also checked to see
which identity is being used via Response.Write( "Identity: " +
System.Security .Principal.Wind owsIdentity.Get Current.Name + "<br/>")

(clever idea!) and found that it's the ASPNET user. That user has all the
permissions in the world, aside from being an Administrator. I really am
stumped!

--Brent
Nov 18 '05 #4
What OS are you running? If Win2K3, then I can't help... ;)
"Brent Bigler" <bb*****@yahoo. com> wrote in message
news:uS******** ******@tk2msftn gp13.phx.gbl...
The computer: W2K server, domain controller, Microsoft.Net Framework 1.1

=============== =========
The error message:

Access to the path "c:\fanmail\new files" is denied
...

Exception Details: System.Unauthor izedAccessExcep tion: Access to the path
"c:\fanmail\new files" is denied

*(see below for Stack Trace)

=============== =========

Fixes tried (but didn't work):

1. Added ASPNET account to c:\fanmail\newf iles and granted full permission
to resource;

2. Added ASPNET to Administrator group;

3. Changed machine.config processModel username setting to "SYSTEM";

4. Changed machine.config processModel username setting to "{Domain}\ASPNE T" along with the password setting to the appropriate password;

5. Sacrificed three chickens and a goat (in theory).

=============== ========

Most of the articles I've read say it's simply a permissions problem, like
the error reports. But it doesn't seem that any kind of permission changing on the resource works. Anything else I should try?

Thanks for any help!

--Brent

-------------------------------------------------------------------------- -- -
The code class giving me the problems (from clsFTP, downloaded from
someplace on the Web)

=============== =============== =====
Public Sub DownloadFile(By Val sFileName As String, _
ByVal sLocalFileName As String, _
ByVal bResume As Boolean)
Dim st As Stream
Dim output As FileStream
Dim cSocket As Socket
Dim offset, npos As Long

If (Not (m_bLoggedIn)) Then
Login()
End If

SetBinaryMode(T rue)

If (sLocalFileName .Equals("")) Then
sLocalFileName = sFileName
End If

If (Not (File.Exists(sL ocalFileName))) Then
st = File.Create(sLo calFileName) '<----Error here, I presume
st.Close()
End If

output = New FileStream(sLoc alFileName, FileMode.Open)
cSocket = CreateDataSocke t()
offset = 0

If (bResume) Then
offset = output.Length

If (offset > 0) Then
SendCommand("RE ST " & offset)
If (m_iRetValue <> 350) Then
'throw new IOException(rep ly.Substring(4) );
'Some servers may not support resuming.
offset = 0
End If
End If

If (offset > 0) Then
npos = output.Seek(off set, SeekOrigin.Begi n)
End If
End If

SendCommand("RE TR " & sFileName)

If (Not (m_iRetValue = 150 Or m_iRetValue = 125)) Then
MessageString = m_sReply
Throw New IOException(m_s Reply.Substring (4))
End If

Do While (True)
m_aBuffer.Clear (m_aBuffer, 0, m_aBuffer.Lengt h)
m_iBytes = cSocket.Receive (m_aBuffer, m_aBuffer.Lengt h, 0)
output.Write(m_ aBuffer, 0, m_iBytes)

If (m_iBytes <= 0) Then
Exit Do
End If
Loop

output.Close()
If (cSocket.Connec ted) Then
cSocket.Close()
End If

ReadReply()
If (Not (m_iRetValue = 226 Or m_iRetValue = 250)) Then
MessageString = m_sReply
Throw New IOException(m_s Reply.Substring (4))
End If

End Sub
=============== ============

Stack Trace:

[UnauthorizedAcc essException: Access to the path "c:\FanMail\New Files" is
denied.]
System.IO.__Err or.WinIOError(I nt32 errorCode, String str) +393
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) +44
clsFTP.Download File(String sFileName, String sLocalFileName, Boolean
bResume) +120
clsFTP.Download File(String sFileName, String sLocalFileName) +13
ASP.test_aspx.P age_Load() in C:\ClientsWeb\t est.aspx:20
System.Web.Util .ArglessEventHa ndlerDelegatePr oxy.Callback(Ob ject sender, EventArgs e) +10
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +731

Nov 18 '05 #5

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

Similar topics

0
2949
by: Phil Powell | last post by:
I am having trouble retrieving URLs using curl for PHP whereby the URL requires a cookie to produce proper data. I wrote a wrapper class called Timer that will time the execution/download of a remote URL and it uses curl as its means of obtaining the URL: class Timer extends View { /** * @access private
11
4407
by: Wayne Wengert | last post by:
I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000 database. I want to display a list of all tables in an Access database. I want to put that list of table names in a listbox so the user can select the table they want to use. How can I do this? -- ------------------------------------ Wayne Wengert wayne@wengert.org
12
2514
by: Russ | last post by:
Hello. My new dev machine is running XP Pro. In the past all equipment has only used Windows 2000. I have had a lot of problems getting my projects up and running on the new machine. The current one is a permission error. The project is a VC++ Web Service. It works fine when the service is hosted on the old W2K dev machine, but on the new XP machine I get a permission error when the service tries to open a text file on the Windows...
3
2756
by: Chua Wen Ching | last post by:
Hi there, I had applied this security permissions in my class library based on fxcop standards. Before namespace: using System.Runtime.InteropServices; using System.Security.Permissions;
0
1218
by: Jeremy | last post by:
I have an ASP.net application which needs to retreive images from multiple remote machines. It is reterieveing images generated by a web cam service on those machines. All of these machines, including the development machine are running on the same windows user account. On the development machine, the app works great. The other client machines run into directory permission problems when attemptiong to browse the directory the images are...
9
1190
by: Sachin | last post by:
Hi All, I have installed an ASP.NET application under a web site. ASP.NET application uses an Impersonation Account, specified in Web.Config. Authentication mode is set to Windows and anonymous access is disabled (deny ="?"). While accessing the Web Site (Web App) it prompts for User Name and
0
1712
by: beachboy | last post by:
I have moving the application from windows 2000 to windows 2003, that application is using .net framework ver 1.1 and have their own COM library to do a specify task. I have registed on "COM+ Services", but can't run those aspx page: error when run aspx pages: Server Error in '/' Application. ---------------------------------------------------------------------------- ----
1
3794
by: Snolly | last post by:
Hi all, I am using the open source dojo toolkit v .4.3 (I know it's old but can't upgrade). I have a page with an iframe in it. When the page loads, the iframe is pointing at a local resource (i.e. another page on the same server). The iframe is then navigated to an external resource (a page from another server). At this point everything is as expected. The problem occurs if I now click a link outside of the iFrame. I get:
0
8357
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8803
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8700
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8581
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7298
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.