473,320 Members | 2,162 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,320 software developers and data experts.

Cannot find a part of the path Error

Ben
Hi All,
I know there have been previous posts with this topic but the issue for
most seems to be the security permissions on the shared drive. My
scenario is as follows :
I have IIS on local machine, I have code on a mapped drive in the
network.
I tried writing to a folder on the mapped drive and then also to a
folder in my C:, both give the same error "Cannot fnd a part of the
path". I gave the local folder FULL CONTROL to the user EVERYONE, still
doesnt make a difference.
My code is as follows :
try
{
FileStream File = new
FileStream(ConfigurationSettings.AppSettings["file_location"] +
System.DateTime.Now.Ticks.ToString() + ".xml", FileMode.Append,
FileAccess.Write);
System.Web.HttpContext.Current.Response.Write("Cre ated the File
Stream");
StreamWriter sw = new StreamWriter(File);
sw.WriteLine(a.OuterXml);
sw.Close();

}
catch(Exception e)
{
Response.Write(e.Message);
Response.End();
}
Any help is greatly appreciated.
Thanks in advance,
Arthur

*** Sent via Developersdex http://www.developersdex.com ***
Sep 13 '06 #1
9 6102
Ben,
"Cannot find a part of the path..." is not a permissions exception, its a
file path syntax exception. Unfortunately, you haven't shown us what you have
stored in

AppSettings["file_location"] - so we can only guess what you've got in there.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ben" wrote:
Hi All,
I know there have been previous posts with this topic but the issue for
most seems to be the security permissions on the shared drive. My
scenario is as follows :
I have IIS on local machine, I have code on a mapped drive in the
network.
I tried writing to a folder on the mapped drive and then also to a
folder in my C:, both give the same error "Cannot fnd a part of the
path". I gave the local folder FULL CONTROL to the user EVERYONE, still
doesnt make a difference.
My code is as follows :
try
{
FileStream File = new
FileStream(ConfigurationSettings.AppSettings["file_location"] +
System.DateTime.Now.Ticks.ToString() + ".xml", FileMode.Append,
FileAccess.Write);
System.Web.HttpContext.Current.Response.Write("Cre ated the File
Stream");
StreamWriter sw = new StreamWriter(File);
sw.WriteLine(a.OuterXml);
sw.Close();

}
catch(Exception e)
{
Response.Write(e.Message);
Response.End();
}
Any help is greatly appreciated.
Thanks in advance,
Arthur

*** Sent via Developersdex http://www.developersdex.com ***
Sep 13 '06 #2
Perhaps the IIS user account doesn't have that mapped drive? Log locally
onto the machine as that user, and see for yourself!

"Ben" <no****@devdex.comwrote in message
news:Oo**************@TK2MSFTNGP02.phx.gbl...
Hi All,
I know there have been previous posts with this topic but the issue for
most seems to be the security permissions on the shared drive. My
scenario is as follows :
I have IIS on local machine, I have code on a mapped drive in the
network.
I tried writing to a folder on the mapped drive and then also to a
folder in my C:, both give the same error "Cannot fnd a part of the
path". I gave the local folder FULL CONTROL to the user EVERYONE, still
doesnt make a difference.
My code is as follows :
try
{
FileStream File = new
FileStream(ConfigurationSettings.AppSettings["file_location"] +
System.DateTime.Now.Ticks.ToString() + ".xml", FileMode.Append,
FileAccess.Write);
System.Web.HttpContext.Current.Response.Write("Cre ated the File
Stream");
StreamWriter sw = new StreamWriter(File);
sw.WriteLine(a.OuterXml);
sw.Close();

}
catch(Exception e)
{
Response.Write(e.Message);
Response.End();
}
Any help is greatly appreciated.
Thanks in advance,
Arthur

*** Sent via Developersdex http://www.developersdex.com ***

Sep 13 '06 #3
Ben


Peter,
<add key="file_location" value="C:\Projects\MyProject\Xml\"/>

is the value for the file path, which i am able to browse to.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Sep 13 '06 #4
Originally you said you had a mapped drive..so this is a reduced test?

And this is directory is on the server, correct?

Response.Write the full concatenated path and filename and post here

Jeff
"Ben" <no****@devdex.comwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
>

Peter,
<add key="file_location" value="C:\Projects\MyProject\Xml\"/>

is the value for the file path, which i am able to browse to.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***

Sep 13 '06 #5
Also, keep in mind you may need to escape the \ with two \\ in C#

"Jeff Dillon" <je****@nowhere.comwrote in message
news:Ow**************@TK2MSFTNGP03.phx.gbl...
Originally you said you had a mapped drive..so this is a reduced test?

And this is directory is on the server, correct?

Response.Write the full concatenated path and filename and post here

Jeff
"Ben" <no****@devdex.comwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
>>

Peter,
<add key="file_location" value="C:\Projects\MyProject\Xml\"/>

is the value for the file path, which i am able to browse to.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***


Sep 13 '06 #6
Ben
I would like to make it work atleast for the non-mapped drive, the C:
drive is on my local machine, not on the server i was trying to map to.

C:/Projects/AdminReports/Xml/632937556787535301.xml

this is concatenated path+filename.
Thanks,
Ben

*** Sent via Developersdex http://www.developersdex.com ***
Sep 13 '06 #7
Ben

Added \\ instead of \ and still get the same error.
*** Sent via Developersdex http://www.developersdex.com ***
Sep 13 '06 #8
It has to be on the server. This is a web page right? The code is executing
on the IIS server!

C:\Projects... has to be on the IIS server for the code you've shown.

And it's \ not /
"Ben" <no****@devdex.comwrote in message
news:Ob**************@TK2MSFTNGP04.phx.gbl...
>I would like to make it work atleast for the non-mapped drive, the C:
drive is on my local machine, not on the server i was trying to map to.

C:/Projects/AdminReports/Xml/632937556787535301.xml

this is concatenated path+filename.
Thanks,
Ben

*** Sent via Developersdex http://www.developersdex.com ***

Sep 13 '06 #9
Ben


Of Course ! That fixed it. Thanks a lot Jeff for you help with this.

*** Sent via Developersdex http://www.developersdex.com ***
Sep 13 '06 #10

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

Similar topics

1
by: Matthias Ludwig | last post by:
I'm trying to create a directory on the web server with a vb.net code: .... Dim dirName As String = "w:\filepath\images" If Not Directory.Exists(dirName) Then...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
by: Alex | last post by:
Hello, in my company, we have a diagnostic tool for hardware. Depending on the hardware projcet, a different project configuration is needed. The configuration file is written in XML and...
3
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
0
by: Terry | last post by:
When launching file 'eSurvey.aspx' via the browser the following error occurs. However, when I test the 'eSurvey.aspx' file via Visual Studio, it works without errors. Why? And, how can I...
1
by: Arthur | last post by:
Hi All, I know there have been previous posts with this topic but the issue for most seems to be the security permissions on the shared drive. My scenario is as follows : I have IIS on local...
2
by: cmt | last post by:
Greetings! I have an asp page that writes out a URL that points to files on a network drive. It has been working fine up until a week ago. I haven't made any changes to the server or code, so...
9
by: reachmsn | last post by:
Hi, At the url http://www.python.org/doc/essays/graphs.html there is some code by Guido Van Rossum for computing paths through a graph - I have pasted it below for reference - Let's write a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.