472,986 Members | 2,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Access network shares with filesystemobject

I have a page in classic asp that accces a network drive, The code is as
follows:
<%
dim fso
dim objFolder
set fso=server.createObject("Scripting.FileSystemObjec t")
set objFolder=fso.GetFolder("f:\")
for each objFile in objFolder.files
response.write objFile.name & "<br>"
next
%>

(f: is a network drive)
I am trying to do the same thing in asp.net. My code behind is as follows:

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

....

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateObject("Scripting.FileSystemObject")
strFolder = "f:\"
objFolder = fso.getFolder(strFolder)
For Each objFile In objFolder.files
Response.Write(objFile.name & "<br>")
Next
End Sub
End Class

Both pages run as integrated authentication with no anonymous access
allowed. it works fine in classic asp, but not in asp.net. It works in
asp.net if I access a local folder like c:\. The error I get in asp.net is:

Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).
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.IO.DirectoryNotFoundException: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).
Nov 19 '05 #1
5 10119
You could use the UNC instead.
io.file.exists(\\server\sharedfolder) instead of mapped drive letter.

"Josh Rolfe" <so*****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I have a page in classic asp that accces a network drive, The code is as
follows:
<%
dim fso
dim objFolder
set fso=server.createObject("Scripting.FileSystemObjec t")
set objFolder=fso.GetFolder("f:\")
for each objFile in objFolder.files
response.write objFile.name & "<br>"
next
%>

(f: is a network drive)
I am trying to do the same thing in asp.net. My code behind is as follows:
Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateObject("Scripting.FileSystemObject")
strFolder = "f:\"
objFolder = fso.getFolder(strFolder)
For Each objFile In objFolder.files
Response.Write(objFile.name & "<br>")
Next
End Sub
End Class

Both pages run as integrated authentication with no anonymous access
allowed. it works fine in classic asp, but not in asp.net. It works in
asp.net if I access a local folder like c:\. The error I get in asp.net is:
Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).
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.IO.DirectoryNotFoundException: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).

Nov 19 '05 #2
Doing gives the same results - I cannot access network shares with UNC
either (although this also works fine in class asp)

"Clamps" <Cl****@Spamless.com> wrote in message
news:e0**************@TK2MSFTNGP10.phx.gbl...
You could use the UNC instead.
io.file.exists(\\server\sharedfolder) instead of mapped drive letter.

"Josh Rolfe" <so*****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I have a page in classic asp that accces a network drive, The code is as
follows:
<%
dim fso
dim objFolder
set fso=server.createObject("Scripting.FileSystemObjec t")
set objFolder=fso.GetFolder("f:\")
for each objFile in objFolder.files
response.write objFile.name & "<br>"
next
%>

(f: is a network drive)
I am trying to do the same thing in asp.net. My code behind is as

follows:

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateObject("Scripting.FileSystemObject")
strFolder = "f:\"
objFolder = fso.getFolder(strFolder)
For Each objFile In objFolder.files
Response.Write(objFile.name & "<br>")
Next
End Sub
End Class

Both pages run as integrated authentication with no anonymous access
allowed. it works fine in classic asp, but not in asp.net. It works in
asp.net if I access a local folder like c:\. The error I get in asp.net

is:

Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).
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.IO.DirectoryNotFoundException: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).


Nov 19 '05 #3
Mixing ASP and ASP.NET code seldom returns good results.

See this source code from the ASP.NET QuickStart
for a good example which uses native .NET Framework methods :

http://samples.gotdotnet.com/quickst.../directory.src

I put it online at : http://asp.net.do/test/dirlist2.aspx
so you can see it in action, since the above sample
has a directory mistake, but the code is the same.

Juan T. Llibre
ASP.NET FAQ : http://asp.net.do/faq/
===========================

"Josh Rolfe" <so*****@microsoft.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Doing gives the same results - I cannot access network shares with UNC either (although
this also works fine in class asp)

"Clamps" <Cl****@Spamless.com> wrote in message
news:e0**************@TK2MSFTNGP10.phx.gbl...
You could use the UNC instead.
io.file.exists(\\server\sharedfolder) instead of mapped drive letter.

"Josh Rolfe" <so*****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I have a page in classic asp that accces a network drive, The code is as
follows:
<%
dim fso
dim objFolder
set fso=server.createObject("Scripting.FileSystemObjec t")
set objFolder=fso.GetFolder("f:\")
for each objFile in objFolder.files
response.write objFile.name & "<br>"
next
%>

(f: is a network drive)
I am trying to do the same thing in asp.net. My code behind is as

follows:

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateObject("Scripting.FileSystemObject")
strFolder = "f:\"
objFolder = fso.getFolder(strFolder)
For Each objFile In objFolder.files
Response.Write(objFile.name & "<br>")
Next
End Sub
End Class

Both pages run as integrated authentication with no anonymous access
allowed. it works fine in classic asp, but not in asp.net. It works in
asp.net if I access a local folder like c:\. The error I get in asp.net

is:

Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).
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.IO.DirectoryNotFoundException: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).



Nov 19 '05 #4
asp runs pages with the iis authentication account defined for anonymous.
you proably specified a domain account.

asp.net runs as the asp.net account no matter the iis creditals. tell
asp.net to use the iis creditials by setting <Identity Impersonate=true> in
the web config. still must setup a domain account for anonymous.

-- bruce (sqlwork.com)

"Josh Rolfe" <so*****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I have a page in classic asp that accces a network drive, The code is as
follows:
<%
dim fso
dim objFolder
set fso=server.createObject("Scripting.FileSystemObjec t")
set objFolder=fso.GetFolder("f:\")
for each objFile in objFolder.files
response.write objFile.name & "<br>"
next
%>

(f: is a network drive)
I am trying to do the same thing in asp.net. My code behind is as
follows:

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateObject("Scripting.FileSystemObject")
strFolder = "f:\"
objFolder = fso.getFolder(strFolder)
For Each objFile In objFolder.files
Response.Write(objFile.name & "<br>")
Next
End Sub
End Class

Both pages run as integrated authentication with no anonymous access
allowed. it works fine in classic asp, but not in asp.net. It works in
asp.net if I access a local folder like c:\. The error I get in asp.net
is:

Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).
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.IO.DirectoryNotFoundException: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).

Nov 19 '05 #5
Ben
I don't know if any of this helps...

http://msdn.microsoft.com/library/de...SecNetch08.asp
Accessing Files on a UNC File Share
If your application needs to access files on a Universal Naming Convention
(UNC) share using ASP.NET, it is important to add NTFS permissions to the
share's folder. You will also need to set the share's permissions to grant
at least read access to either the ASP.NET process account or the
impersonated identity (if your application is configured for impersonation).

http://www.dotnetjunkies.net/Forums/...px?PostID=1531
http://west-wind.com/weblog/posts/1572.aspx

"Josh Rolfe" <so*****@microsoft.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Doing gives the same results - I cannot access network shares with UNC
either (although this also works fine in class asp)

"Clamps" <Cl****@Spamless.com> wrote in message
news:e0**************@TK2MSFTNGP10.phx.gbl...
You could use the UNC instead.
io.file.exists(\\server\sharedfolder) instead of mapped drive letter.

"Josh Rolfe" <so*****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I have a page in classic asp that accces a network drive, The code is
as
follows:
<%
dim fso
dim objFolder
set fso=server.createObject("Scripting.FileSystemObjec t")
set objFolder=fso.GetFolder("f:\")
for each objFile in objFolder.files
response.write objFile.name & "<br>"
next
%>

(f: is a network drive)
I am trying to do the same thing in asp.net. My code behind is as

follows:

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateObject("Scripting.FileSystemObject")
strFolder = "f:\"
objFolder = fso.getFolder(strFolder)
For Each objFile In objFolder.files
Response.Write(objFile.name & "<br>")
Next
End Sub
End Class

Both pages run as integrated authentication with no anonymous access
allowed. it works fine in classic asp, but not in asp.net. It works in
asp.net if I access a local folder like c:\. The error I get in asp.net

is:

Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).
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.IO.DirectoryNotFoundException: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND).



Nov 19 '05 #6

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

Similar topics

11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
6
by: Rob | last post by:
Hi, I am working on a project that requires a Windows Service which performs the following file transfer functions. 1. It monitors a specific local directory on a Windows 2003 Server. 2. When...
12
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
3
by: kihoshk | last post by:
Hi, I have a C# app that needs to copy files from the local machine to another on a WORGROUP network (not a domain). The app is running as a service under the SYSTEM account. When an attempt is...
6
by: tendim | last post by:
G'day group. Currently our organization us using VB6 based applications, and I am trying to push forward and migrate some of the smaller things to VB.NET, eventually migrating all applications...
7
by: Patrick.O.Ige | last post by:
I moved web apps to Win2003. I have given read/write access rights to machinename/IIS_WPG but still getting the error "Access to the path "c:\inetpub\wwwroot\myApp" is denied. " Also gave...
5
by: dad59 | last post by:
I've been fighting this for 3 days. In an existing domain we have had a win2k3 Domain controller and 10 workstations. Website has been on this server and finally getting to move it to a brand new...
25
by: p byers | last post by:
Good Morning Folks I have a LAN Among the several connections to it are the following four devices: A MAXSTOR network Storage Device A PC running Microsoft Windows 2000 Server 5.0.2195 (SP4) A...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.