473,387 Members | 1,549 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,387 software developers and data experts.

Reference a virtual folder

Is the sample below valid for referencing a virtual folder named OracleFiles
in a web site where the aspx page that is using this code is under the root
folder of the subweb? Some users are getting exception errors. Thanks.

Dim strPath As String = Server.MapPath("~/OracleFiles")

-David
Nov 4 '08 #1
8 2004
"David C" <dl*****@lifetimeinc.comwrote in message
news:OQ**************@TK2MSFTNGP06.phx.gbl...
Some users are getting exception errors.
When posting to a technical newsgroup because users are getting errors, it's
really important to actually say what the errors are...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 4 '08 #2
Sorry. Error is below.

An unhandled exception occurred:

Message: The network path was not found.

Stack Trace:

at System.IO.__Error.WinIOError(Int32 errorCode, String

maybeFullPath)

at System.IO.Directory.InternalGetFileDirectoryNames( String path, String
userPathOriginal, String searchPattern, Boolean includeFiles, Boolean
includeDirs, SearchOption searchOption)

at System.IO.Directory.GetFiles(String path, String searchPattern,
SearchOption searchOption)

at Microsoft.VisualBasic.FileIO.FileSystem.FindPaths( FileOrDirectory

FileOrDirectory, String directory, String wildCard)

at

Microsoft.VisualBasic.FileIO.FileSystem.FindFilesO rDirectories(FileOrDir

ectory FileOrDirectory, String directory, SearchOption searchType, String[]
wildcards, Collection`1 Results)

at Microsoft.VisualBasic.MyServices.FileSystemProxy.G etFiles(String

directory, SearchOption searchType, String[] wildcards)

at UtilClass.FilesInPathType(String strPhyPath, String strSuffix) in
http://server//FileRoom/App_Code/UtilClass.vb:line 94

at ASP.frmmain_aspx.__Render__control1(HtmlTextWriter __w, Control

parameterContainer) in http://server//fileroom/frmMain.aspx:line 39

at System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter

writer, ICollection children)

at System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer)

at System.Web.UI.Page.Render(HtmlTextWriter writer)

at System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter)

at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter)

at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)

at System.Web.UI.Page.ProcessRequestMain(Boolean

includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uc**************@TK2MSFTNGP02.phx.gbl...
"David C" <dl*****@lifetimeinc.comwrote in message
news:OQ**************@TK2MSFTNGP06.phx.gbl...
>Some users are getting exception errors.

When posting to a technical newsgroup because users are getting errors,
it's really important to actually say what the errors are...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 4 '08 #3
"David C" <dl*****@lifetimeinc.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>Is the sample below valid for referencing a virtual folder named
OracleFiles in a web site where the aspx page that is using this code is
under the root folder of the subweb? Some users are getting exception
errors

What is the error?

Sorry. Error is below.

An unhandled exception occurred:

Message: The network path was not found.

Stack Trace:

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
Server.MapPath doesn't always return what you think it should:
http://bytes.com/forum/thread53065.html

If you set a breakpoint on the line in question and inspect
Server.MapPath("~/OracleFiles"), what does it show? Is it correct?

What does Request.ServerVariables("APPL_PHYSICAL_PATH ") return? Is that
correct?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 5 '08 #4
From the stack it doesn't appear to be in this function. I would say rather
that you do a recursive search and that it could fail if the user is not
allowed to browse all directories or if some other users remove a directory
when another one is doing something.

If it always fails for a given user, it would be a clue...

Plus in case you can just make sure (we just stuff this value in a session
variable and this is shown our next error report allwing us to check if
needed if the value is correct).

To add to Mark and not sure what is his intent, but it doesns't seems to be
a bug in Server.MapPath but rather that it was misued by the user. You
correctly used ~/ so it will return the path for OracleFiles under your
application root (and not under the site root whihc could cause a problem).

Moreover this is the kind of server side code that is not user dependent. So
the problem IMHO is definitely not with Server.MapPath...

--
Patrice

"David C" <dl*****@lifetimeinc.coma écrit dans le message de groupe de
discussion : #A**************@TK2MSFTNGP03.phx.gbl...
Sorry. Error is below.

An unhandled exception occurred:

Message: The network path was not found.

Stack Trace:

at System.IO.__Error.WinIOError(Int32 errorCode, String

maybeFullPath)

at System.IO.Directory.InternalGetFileDirectoryNames( String path, String
userPathOriginal, String searchPattern, Boolean includeFiles, Boolean
includeDirs, SearchOption searchOption)

at System.IO.Directory.GetFiles(String path, String searchPattern,
SearchOption searchOption)

at Microsoft.VisualBasic.FileIO.FileSystem.FindPaths( FileOrDirectory

FileOrDirectory, String directory, String wildCard)

at

Microsoft.VisualBasic.FileIO.FileSystem.FindFilesO rDirectories(FileOrDir

ectory FileOrDirectory, String directory, SearchOption searchType,
String[] wildcards, Collection`1 Results)

at Microsoft.VisualBasic.MyServices.FileSystemProxy.G etFiles(String

directory, SearchOption searchType, String[] wildcards)

at UtilClass.FilesInPathType(String strPhyPath, String strSuffix) in
http://server//FileRoom/App_Code/UtilClass.vb:line 94

at ASP.frmmain_aspx.__Render__control1(HtmlTextWriter __w, Control

parameterContainer) in http://server//fileroom/frmMain.aspx:line 39

at System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter

writer, ICollection children)

at System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer)

at System.Web.UI.Page.Render(HtmlTextWriter writer)

at System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter)

at System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter)

at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)

at System.Web.UI.Page.ProcessRequestMain(Boolean

includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uc**************@TK2MSFTNGP02.phx.gbl...
>"David C" <dl*****@lifetimeinc.comwrote in message
news:OQ**************@TK2MSFTNGP06.phx.gbl...
>>Some users are getting exception errors.

When posting to a technical newsgroup because users are getting errors,
it's really important to actually say what the errors are...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 5 '08 #5
Here is the lines of code that are part of the problem. The user tells me
that the error is intermittant and apparently is only happening to 1 user.
The process is in the Page_Load event where I am checking to see if any .txt
files exist in a virtual folder to give a warning that there are unprocessed
files that need attention.

If Page.IsPostBack = False Then
'1st time in page so check for Oracle import files
Dim strPath As String = Server.MapPath("~/OracleFiles")
'Use shared function in UtilClass to return count of txt files
Dim intFiles As Int32 = UtilClass.FilesInPathType(strPath,
"*.txt")
If intFiles 0 Then
If intFiles = 1 Then
txtMsg.Text = "There is 1 Oracle check request import
file to be processed."
Else
txtMsg.Text = "There are " & intFiles.ToString & "
Oracle check request import files to be processed."
End If
End If
End If

I wonder if it would be a problem if someone deleted any .txt files a split
second before this process was checked by another user? Thanks.

David

"Patrice" <http://www.chez.com/scribe/wrote in message
news:64**********************************@microsof t.com...
From the stack it doesn't appear to be in this function. I would say
rather that you do a recursive search and that it could fail if the user
is not allowed to browse all directories or if some other users remove a
directory when another one is doing something.

If it always fails for a given user, it would be a clue...

Plus in case you can just make sure (we just stuff this value in a session
variable and this is shown our next error report allwing us to check if
needed if the value is correct).

To add to Mark and not sure what is his intent, but it doesns't seems to
be a bug in Server.MapPath but rather that it was misued by the user. You
correctly used ~/ so it will return the path for OracleFiles under your
application root (and not under the site root whihc could cause a
problem).

Moreover this is the kind of server side code that is not user dependent.
So the problem IMHO is definitely not with Server.MapPath...

--
Patrice

"David C" <dl*****@lifetimeinc.coma écrit dans le message de groupe de
discussion : #A**************@TK2MSFTNGP03.phx.gbl...
>Sorry. Error is below.

An unhandled exception occurred:

Message: The network path was not found.

Stack Trace:

at System.IO.__Error.WinIOError(Int32 errorCode, String

maybeFullPath)

at System.IO.Directory.InternalGetFileDirectoryNames( String path, String
userPathOriginal, String searchPattern, Boolean includeFiles, Boolean
includeDirs, SearchOption searchOption)

at System.IO.Directory.GetFiles(String path, String searchPattern,
SearchOption searchOption)

at Microsoft.VisualBasic.FileIO.FileSystem.FindPaths( FileOrDirectory

FileOrDirectory, String directory, String wildCard)

at

Microsoft.VisualBasic.FileIO.FileSystem.FindFiles OrDirectories(FileOrDir

ectory FileOrDirectory, String directory, SearchOption searchType,
String[] wildcards, Collection`1 Results)

at Microsoft.VisualBasic.MyServices.FileSystemProxy.G etFiles(String

directory, SearchOption searchType, String[] wildcards)

at UtilClass.FilesInPathType(String strPhyPath, String strSuffix) in
http://server//FileRoom/App_Code/UtilClass.vb:line 94

at ASP.frmmain_aspx.__Render__control1(HtmlTextWriter __w, Control

parameterContainer) in http://server//fileroom/frmMain.aspx:line 39

at System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter

writer, ICollection children)

at System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer)

at System.Web.UI.Page.Render(HtmlTextWriter writer)

at System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter)

at System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter)

at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)

at System.Web.UI.Page.ProcessRequestMain(Boolean

includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uc**************@TK2MSFTNGP02.phx.gbl...
>>"David C" <dl*****@lifetimeinc.comwrote in message
news:OQ**************@TK2MSFTNGP06.phx.gbl...

Some users are getting exception errors.

When posting to a technical newsgroup because users are getting errors,
it's really important to actually say what the errors are...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Nov 5 '08 #6
"David C" <dl*****@lifetimeinc.comwrote in message
news:Oz**************@TK2MSFTNGP03.phx.gbl...
Here is the lines of code that are part of the problem.
A couple of questions:

1) Do you know which specific line throws the exception?

2) Do you have exception handling around this code?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 5 '08 #7
From the stack this is inside UtilClass.FilesInPathType(strPath, "*.txt")...
likely in a GetFiles method...

--
Patrice

"David C" <dl*****@lifetimeinc.coma écrit dans le message de groupe de
discussion : Oz**************@TK2MSFTNGP03.phx.gbl...
Here is the lines of code that are part of the problem. The user tells me
that the error is intermittant and apparently is only happening to 1 user.
The process is in the Page_Load event where I am checking to see if any
.txt files exist in a virtual folder to give a warning that there are
unprocessed files that need attention.

If Page.IsPostBack = False Then
'1st time in page so check for Oracle import files
Dim strPath As String = Server.MapPath("~/OracleFiles")
'Use shared function in UtilClass to return count of txt files
Dim intFiles As Int32 = UtilClass.FilesInPathType(strPath,
"*.txt")
If intFiles 0 Then
If intFiles = 1 Then
txtMsg.Text = "There is 1 Oracle check request import
file to be processed."
Else
txtMsg.Text = "There are " & intFiles.ToString & "
Oracle check request import files to be processed."
End If
End If
End If

I wonder if it would be a problem if someone deleted any .txt files a
split second before this process was checked by another user? Thanks.

David

"Patrice" <http://www.chez.com/scribe/wrote in message
news:64**********************************@microsof t.com...
>From the stack it doesn't appear to be in this function. I would say
rather that you do a recursive search and that it could fail if the user
is not allowed to browse all directories or if some other users remove a
directory when another one is doing something.

If it always fails for a given user, it would be a clue...

Plus in case you can just make sure (we just stuff this value in a
session variable and this is shown our next error report allwing us to
check if needed if the value is correct).

To add to Mark and not sure what is his intent, but it doesns't seems to
be a bug in Server.MapPath but rather that it was misued by the user. You
correctly used ~/ so it will return the path for OracleFiles under your
application root (and not under the site root whihc could cause a
problem).

Moreover this is the kind of server side code that is not user dependent.
So the problem IMHO is definitely not with Server.MapPath...

--
Patrice

"David C" <dl*****@lifetimeinc.coma écrit dans le message de groupe de
discussion : #A**************@TK2MSFTNGP03.phx.gbl...
>>Sorry. Error is below.

An unhandled exception occurred:

Message: The network path was not found.

Stack Trace:

at System.IO.__Error.WinIOError(Int32 errorCode, String

maybeFullPath)

at System.IO.Directory.InternalGetFileDirectoryNames( String path, String
userPathOriginal, String searchPattern, Boolean includeFiles, Boolean
includeDirs, SearchOption searchOption)

at System.IO.Directory.GetFiles(String path, String searchPattern,
SearchOption searchOption)

at Microsoft.VisualBasic.FileIO.FileSystem.FindPaths( FileOrDirectory

FileOrDirectory, String directory, String wildCard)

at

Microsoft.VisualBasic.FileIO.FileSystem.FindFile sOrDirectories(FileOrDir

ectory FileOrDirectory, String directory, SearchOption searchType,
String[] wildcards, Collection`1 Results)

at Microsoft.VisualBasic.MyServices.FileSystemProxy.G etFiles(String

directory, SearchOption searchType, String[] wildcards)

at UtilClass.FilesInPathType(String strPhyPath, String strSuffix) in
http://server//FileRoom/App_Code/UtilClass.vb:line 94

at ASP.frmmain_aspx.__Render__control1(HtmlTextWriter __w, Control

parameterContainer) in http://server//fileroom/frmMain.aspx:line 39

at System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter

writer, ICollection children)

at System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer)

at System.Web.UI.Page.Render(HtmlTextWriter writer)

at System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter)

at System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter)

at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)

at System.Web.UI.Page.ProcessRequestMain(Boolean

includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uc**************@TK2MSFTNGP02.phx.gbl...
"David C" <dl*****@lifetimeinc.comwrote in message
news:OQ**************@TK2MSFTNGP06.phx.gbl...

Some users are getting exception errors.

When posting to a technical newsgroup because users are getting errors,
it's really important to actually say what the errors are...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Nov 5 '08 #8
The line setting intFiles variable that calls the following function in a
class

Public Shared Function FilesInPathType(ByVal strPhyPath As String, _
ByVal strSuffix As String) As Integer
Dim intFiles As Integer =
My.Computer.FileSystem.GetFiles(strPhyPath,
FileIO.SearchOption.SearchTopLevelOnly, strSuffix).Count
FilesInPathType = intFiles
End Function

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uu**************@TK2MSFTNGP03.phx.gbl...
"David C" <dl*****@lifetimeinc.comwrote in message
news:Oz**************@TK2MSFTNGP03.phx.gbl...
>Here is the lines of code that are part of the problem.

A couple of questions:

1) Do you know which specific line throws the exception?

2) Do you have exception handling around this code?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 5 '08 #9

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

Similar topics

1
by: Juan Daniel Caicedo | last post by:
I create an user session with ASP in a Virtual Folder. When the ASP try to delete a subfolder in the same virtual folder app, FSO delete the folder but they clean the session and clean all...
2
by: Julie J. | last post by:
How do you create a virtual folder in VS.NET? It is simple enough to create a physical folder, but I want to create virtual folders like I was able to do in VS 6. Anyone know how? -JJ-
2
by: flat_ross | last post by:
Hi, I am in a shop where developers are required to work off of a network share. This is so that code is backed up nightly. So I am testing running an ASP.NET Web application with a Class...
11
by: ASP.NET User | last post by:
Hi I am in a shop where developers are required to work off of a networ share. This is so that code and other documentation is backed up nightly. This is outside the realm of Visual SourceSafe...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
2
by: Kavitha | last post by:
Hi , Can any one tel me how to create a virtual drive in C#( similar to Gmail Virtual drive).Also tell me what interfaces could be used to create the same. Thanks in Advance Kavitha
3
by: D2 | last post by:
Hi, I am working on an application which have web as well as windows portions. We have some common dlls that are shared by both windows and web. To make it more maintainable, we want to place...
6
by: ManagedCoder | last post by:
Hi, My requirement is as follows: I need to set the HttpExpires (enable content expiration - set to 7 days) on a folder within a virtual directory. I have been able to set the HttpExpires...
1
by: mosfet | last post by:
Hi, I am trying to modify existing code to use smart pointers and I get some issues with virtual methods : class Folder : public Object { public: friend class PimItemCollection; friend...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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,...
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...

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.