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 8 2025
"David C" <dl*****@lifeti meinc.comwrote in message
news:OQ******** ******@TK2MSFTN GP06.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
Sorry. Error is below.
An unhandled exception occurred:
Message: The network path was not found.
Stack Trace:
at System.IO.__Err or.WinIOError(I nt32 errorCode, String
maybeFullPath)
at System.IO.Direc tory.InternalGe tFileDirectoryN ames(String path, String
userPathOrigina l, String searchPattern, Boolean includeFiles, Boolean
includeDirs, SearchOption searchOption)
at System.IO.Direc tory.GetFiles(S tring path, String searchPattern,
SearchOption searchOption)
at Microsoft.Visua lBasic.FileIO.F ileSystem.FindP aths(FileOrDire ctory
FileOrDirectory , String directory, String wildCard)
at
Microsoft.Visua lBasic.FileIO.F ileSystem.FindF ilesOrDirectori es(FileOrDir
ectory FileOrDirectory , String directory, SearchOption searchType, String[]
wildcards, Collection`1 Results)
at Microsoft.Visua lBasic.MyServic es.FileSystemPr oxy.GetFiles(St ring
directory, SearchOption searchType, String[] wildcards)
at UtilClass.Files InPathType(Stri ng strPhyPath, String strSuffix) in http://server//FileRoom/App_Code/UtilClass.vb:line 94
at ASP.frmmain_asp x.__Render__con trol1(HtmlTextW riter __w, Control
parameterContai ner) in http://server//fileroom/frmMain.aspx:line 39
at System.Web.UI.C ontrol.RenderCh ildrenInternal( HtmlTextWriter
writer, ICollection children)
at System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
at System.Web.UI.P age.Render(Html TextWriter writer)
at System.Web.UI.C ontrol.RenderCo ntrolInternal(H tmlTextWriter writer,
ControlAdapter adapter)
at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer, ControlAdapter
adapter)
at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:uc******** ******@TK2MSFTN GP02.phx.gbl...
"David C" <dl*****@lifeti meinc.comwrote in message
news:OQ******** ******@TK2MSFTN GP06.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
"David C" <dl*****@lifeti meinc.comwrote in message
news:%2******** ********@TK2MSF TNGP03.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.__Err or.WinIOError(I nt32 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.ServerV ariables("APPL_ PHYSICAL_PATH ") return? Is that
correct?
--
Mark Rae
ASP.NET MVP http://www.markrae.net
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*****@lifeti meinc.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.__Err or.WinIOError(I nt32 errorCode, String
maybeFullPath)
at System.IO.Direc tory.InternalGe tFileDirectoryN ames(String path, String
userPathOrigina l, String searchPattern, Boolean includeFiles, Boolean
includeDirs, SearchOption searchOption)
at System.IO.Direc tory.GetFiles(S tring path, String searchPattern,
SearchOption searchOption)
at Microsoft.Visua lBasic.FileIO.F ileSystem.FindP aths(FileOrDire ctory
FileOrDirectory , String directory, String wildCard)
at
Microsoft.Visua lBasic.FileIO.F ileSystem.FindF ilesOrDirectori es(FileOrDir
ectory FileOrDirectory , String directory, SearchOption searchType,
String[] wildcards, Collection`1 Results)
at Microsoft.Visua lBasic.MyServic es.FileSystemPr oxy.GetFiles(St ring
directory, SearchOption searchType, String[] wildcards)
at UtilClass.Files InPathType(Stri ng strPhyPath, String strSuffix) in http://server//FileRoom/App_Code/UtilClass.vb:line 94
at ASP.frmmain_asp x.__Render__con trol1(HtmlTextW riter __w, Control
parameterContai ner) in http://server//fileroom/frmMain.aspx:line 39
at System.Web.UI.C ontrol.RenderCh ildrenInternal( HtmlTextWriter
writer, ICollection children)
at System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
at System.Web.UI.P age.Render(Html TextWriter writer)
at System.Web.UI.C ontrol.RenderCo ntrolInternal(H tmlTextWriter writer,
ControlAdapter adapter)
at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer,
ControlAdapter adapter)
at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:uc******** ******@TK2MSFTN GP02.phx.gbl...
>"David C" <dl*****@lifeti meinc.comwrote in message news:OQ******* *******@TK2MSFT NGP06.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
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.Files InPathType(strP ath,
"*.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.ToStri ng & "
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******** *************** ***********@mic rosoft.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*****@lifeti meinc.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.__Err or.WinIOError(I nt32 errorCode, String
maybeFullPat h)
at System.IO.Direc tory.InternalGe tFileDirectoryN ames(String path, String userPathOrigin al, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption)
at System.IO.Direc tory.GetFiles(S tring path, String searchPattern, SearchOption searchOption)
at Microsoft.Visua lBasic.FileIO.F ileSystem.FindP aths(FileOrDire ctory
FileOrDirector y, String directory, String wildCard)
at
Microsoft.Visu alBasic.FileIO. FileSystem.Find FilesOrDirector ies(FileOrDir
ectory FileOrDirectory , String directory, SearchOption searchType, String[] wildcards, Collection`1 Results)
at Microsoft.Visua lBasic.MyServic es.FileSystemPr oxy.GetFiles(St ring
directory, SearchOption searchType, String[] wildcards)
at UtilClass.Files InPathType(Stri ng strPhyPath, String strSuffix) in http://server//FileRoom/App_Code/UtilClass.vb:line 94
at ASP.frmmain_asp x.__Render__con trol1(HtmlTextW riter __w, Control
parameterConta iner) in http://server//fileroom/frmMain.aspx:line 39
at System.Web.UI.C ontrol.RenderCh ildrenInternal( HtmlTextWriter
writer, ICollection children)
at System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
at System.Web.UI.P age.Render(Html TextWriter writer)
at System.Web.UI.C ontrol.RenderCo ntrolInternal(H tmlTextWriter writer, ControlAdapt er adapter)
at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer, ControlAdapt er adapter)
at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesB eforeAsyncPoint , Boolean includeStagesAf terAsyncPoint)
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message news:uc******* *******@TK2MSFT NGP02.phx.gbl.. .
>>"David C" <dl*****@lifeti meinc.comwrote in message news:OQ****** ********@TK2MSF TNGP06.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
"David C" <dl*****@lifeti meinc.comwrote in message
news:Oz******** ******@TK2MSFTN GP03.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
From the stack this is inside UtilClass.Files InPathType(strP ath, "*.txt")...
likely in a GetFiles method...
--
Patrice
"David C" <dl*****@lifeti meinc.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.Files InPathType(strP ath,
"*.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.ToStri ng & "
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******** *************** ***********@mic rosoft.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*****@lifeti meinc.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.__Err or.WinIOError(I nt32 errorCode, String
maybeFullPath )
at System.IO.Direc tory.InternalGe tFileDirectoryN ames(String path, String userPathOrigi nal, String searchPattern, Boolean includeFiles, Boolean includeDirs , SearchOption searchOption)
at System.IO.Direc tory.GetFiles(S tring path, String searchPattern, SearchOptio n searchOption)
at Microsoft.Visua lBasic.FileIO.F ileSystem.FindP aths(FileOrDire ctory
FileOrDirecto ry, String directory, String wildCard)
at
Microsoft.Vis ualBasic.FileIO .FileSystem.Fin dFilesOrDirecto ries(FileOrDir
ectory FileOrDirectory , String directory, SearchOption searchType, String[] wildcards, Collection`1 Results)
at Microsoft.Visua lBasic.MyServic es.FileSystemPr oxy.GetFiles(St ring
directory, SearchOption searchType, String[] wildcards)
at UtilClass.Files InPathType(Stri ng strPhyPath, String strSuffix) in http://server//FileRoom/App_Code/UtilClass.vb:line 94
at ASP.frmmain_asp x.__Render__con trol1(HtmlTextW riter __w, Control
parameterCont ainer) in http://server//fileroom/frmMain.aspx:line 39
at System.Web.UI.C ontrol.RenderCh ildrenInternal( HtmlTextWriter
writer, ICollection children)
at System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
at System.Web.UI.P age.Render(Html TextWriter writer)
at System.Web.UI.C ontrol.RenderCo ntrolInternal(H tmlTextWriter writer, ControlAdapte r adapter)
at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer, ControlAdapte r adapter)
at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStages BeforeAsyncPoin t, Boolean includeStagesAf terAsyncPoint)
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message news:uc****** ********@TK2MSF TNGP02.phx.gbl. .. "David C" <dl*****@lifeti meinc.comwrote in message news:OQ***** *********@TK2MS FTNGP06.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
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.Fil eSystem.GetFile s(strPhyPath,
FileIO.SearchOp tion.SearchTopL evelOnly, strSuffix).Coun t
FilesInPathType = intFiles
End Function
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:uu******** ******@TK2MSFTN GP03.phx.gbl...
"David C" <dl*****@lifeti meinc.comwrote in message
news:Oz******** ******@TK2MSFTN GP03.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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 session variables.
Why?
|
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-
|
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
assembly all on a shared drive.
I have the solution working perfectly. However, I have run into a
hiccup. In order to map IIS Virtual Dir to a network drive, you need
|
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 which we also use for code control. The network drive is used as the working folder. This is a configuration this shop has used for 6 years and I do not see it changing any time soon
So I am testing running an ASP.NET Web application with a Clas...
|
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 applications.
I am testing an upgrade of all of the sites and have converted the main root
site...although not necessarily fixed any issues.
I move on instead and converted one of the virtual roots that is a seperate
| |
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
|
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 the common dlls in
one folder from where both win/web can reference.
I have noticed that any reference to web projects automatically copies
the dlls in the bin folder and we don;t have an option to say "do not
copy". What are the options to...
|
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 property on a virtual directory
using the following code:
DirectoryEntry myVdPath = new
|
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 class ContactCollection;
|
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,...
|
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...
| |
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...
|
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,...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |