473,783 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access network shares with filesystemobjec t

I have a page in classic asp that accces a network drive, The code is as
follows:
<%
dim fso
dim objFolder
set fso=server.crea teObject("Scrip ting.FileSystem Object")
set objFolder=fso.G etFolder("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.P age

#Region " Web Form Designer Generated Code "

....

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
strFolder = "f:\"
objFolder = fso.getFolder(s trFolder)
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_PATHNOTF OUND).
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.Direc toryNotFoundExc eption: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTF OUND).
Nov 19 '05 #1
5 10181
You could use the UNC instead.
io.file.exists( \\server\shared folder) instead of mapped drive letter.

"Josh Rolfe" <so*****@micros oft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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.crea teObject("Scrip ting.FileSystem Object")
set objFolder=fso.G etFolder("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.P age

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
strFolder = "f:\"
objFolder = fso.getFolder(s trFolder)
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_PATHNOTF OUND).
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.Direc toryNotFoundExc eption: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTF OUND).

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****@Spamles s.com> wrote in message
news:e0******** ******@TK2MSFTN GP10.phx.gbl...
You could use the UNC instead.
io.file.exists( \\server\shared folder) instead of mapped drive letter.

"Josh Rolfe" <so*****@micros oft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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.crea teObject("Scrip ting.FileSystem Object")
set objFolder=fso.G etFolder("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.P age

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
strFolder = "f:\"
objFolder = fso.getFolder(s trFolder)
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_PATHNOTF OUND).
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.Direc toryNotFoundExc eption: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTF OUND).


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*****@micros oft.com> wrote in message
news:%2******** *******@TK2MSFT NGP11.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****@Spamles s.com> wrote in message
news:e0******** ******@TK2MSFTN GP10.phx.gbl...
You could use the UNC instead.
io.file.exists( \\server\shared folder) instead of mapped drive letter.

"Josh Rolfe" <so*****@micros oft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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.crea teObject("Scrip ting.FileSystem Object")
set objFolder=fso.G etFolder("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.P age

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
strFolder = "f:\"
objFolder = fso.getFolder(s trFolder)
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_PATHNOTF OUND).
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.Direc toryNotFoundExc eption: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTF OUND).



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=tru e> in
the web config. still must setup a domain account for anonymous.

-- bruce (sqlwork.com)

"Josh Rolfe" <so*****@micros oft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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.crea teObject("Scrip ting.FileSystem Object")
set objFolder=fso.G etFolder("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.P age

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
strFolder = "f:\"
objFolder = fso.getFolder(s trFolder)
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_PATHNOTF OUND).
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.Direc toryNotFoundExc eption: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTF OUND).

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*****@micros oft.com> wrote in message
news:%2******** *******@TK2MSFT NGP11.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****@Spamles s.com> wrote in message
news:e0******** ******@TK2MSFTN GP10.phx.gbl...
You could use the UNC instead.
io.file.exists( \\server\shared folder) instead of mapped drive letter.

"Josh Rolfe" <so*****@micros oft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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.crea teObject("Scrip ting.FileSystem Object")
set objFolder=fso.G etFolder("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.P age

#Region " Web Form Designer Generated Code "

...

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim fso, objFolder, objFile As Object
Dim strFolder As String
fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
strFolder = "f:\"
objFolder = fso.getFolder(s trFolder)
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_PATHNOTF OUND).
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.Direc toryNotFoundExc eption: Exception from
HRESULT: 0x800A004C (CTL_E_PATHNOTF OUND).



Nov 19 '05 #6

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

Similar topics

11
6601
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 where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
16
48887
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 a commercial program such as Adobe Acrobat and its associated API. The technique uses Ghostscript and Redirection Port Monitor - two free programs for creating PDF documents provided free by Russell Lang. The actual automation requires VBA...
6
2938
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 it finds files with a specific extension, it queries a SQL Server database to determine what workstation will be the destination of a File.Copy. 3. It copies those files to the appropriate workstations on the LAN,
12
3099
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 asp editing (like I used to be able to do with 2K/IIS5) where I use VS.NET, open an asp file, make changes, save and refresh my browser. Problem is that I get an Access is Denied error when I try to save the file and then the file gets wiped on...
3
2021
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 made to copy the file from one machine to the other, a User Name and Password error is thrown. This also occurs when I run the service under my account on both machines (though it's not a domain, both machines have the same user-names and...
6
2972
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 from VB6 and other legacy languages/systems (Pure VBScript, DataEase, etc.) over to .NET. Currently, *all* user data is stored on network shares. When a user logs in to a workstation, their home drive is mounted from one share, all of their...
7
2339
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 machinename/IIS_WPG rights to the folder myApp What i notied is that the folder has Read Only attributes ticked if i right clicked myApp properties . Could this be the problem ? But i have tried turning off the read only.
5
2646
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 win2k3 server that is member in the domain. Problem is when all on the same machine I have one web app in ASP that reads data in from files in the local file system and all works well. Access to the app is through SSL and anonymous auth is...
25
3015
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 PC running Microsoft Windows XP Professional 5.1.2600 (SP2) A PC running Microsoft Windows XP Professional 5.1.2600 (SP2) All of the PCs are running IIS
0
9643
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
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10083
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
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
7494
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
6737
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
5379
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
4044
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
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.