Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 21st, 2009, 01:00 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default Could not find a part of the path '../../Web

Hi there this in my las trouble 4 this project,
I have a label that reads from a text file page load, on my PC works fine, i upload it on the server changed the path and the error came up.

on my machine the path is:C:\Users\test\, when i upload this on the server how do i change this?

thanks
__________________
bx
  #2 (permalink)  
Old March 21st, 2009, 01:06 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

When testing web applications you should try to keep your dev environment setup as close to the that of the production environment as possible to help avoid these types of errors.

What do you mean by this line: "on my machine the path is:C:\Users\test\, when i upload this on the server how do i change this? "

Are you asking how to change the path from which the file is pulled? Or are you saying that when you upload the text file it goes to a different directory and you want to know how to change that?

-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
  #3 (permalink)  
Old March 21st, 2009, 01:18 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

yes the directory it changes it goes 2 dir up,

in my machine is
Code:
Dim FILE_NAME AsString = "../DATA/Templates/" & Me.Label1.Text & ""
Dim objReader AsNew System.IO.StreamReader(FILE_NAME)
on the server i changed it to :
Code:
Dim FILE_NAME AsString = "../../../DATA/Templates/" & Me.Label1.Text & ""
Dim objReader AsNew System.IO.StreamReader(FILE_NAME)
the error i get in the browser is:
Could not find a part of the path 'c:\windows\system32\..\..\Data\templates\textfile .txt
__________________
bx

Last edited by bex; March 21st, 2009 at 01:28 PM..
  #4 (permalink)  
Old March 21st, 2009, 02:09 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

It appears that the directory structure on your server is different than on your dev box, so naturally, just jumping up 2 directories would not help you.

It also appears you are attempting to read a file in a path outside of your web site. Normally, you wouldn't have permissions to do that in a hosted situation, even if you could correctly resolve the path.

You'd be a lot better off putting textfile.txt in a directory inside your website. I would suggest App_Data, as that would automatically make it secure from being casually browsed by users. Then, resolve the path using Server.MapPath("~/App_Data/textfile.txt") to get the physical path.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
bex (March 21st, 2009)
  #5 (permalink)  
Old March 21st, 2009, 04:13 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

thanks Lee,
__________________
bx


Similar Threads
Thread Thread Starter Forum Replies Last Post
What web part have they used? sharepointbaby BOOK: Beginning SharePoint 2007: Building Team Solutions with MOSS 2007 ISBN: 978-0-470-12449-9 0 May 30th, 2008 08:51 PM
Table path using 4 part naming convention snufse SQL Server 2000 1 February 1st, 2008 07:45 PM
Could not find a part of the path babarrana ASP.NET 2.0 Professional 3 August 21st, 2007 09:05 AM
Error: Could not find a part of the path eelisMX Pro VB.NET 2002/2003 2 July 4th, 2006 02:22 AM
iis cannot find images in relative path vhrao ASP.NET 1.x and 2.0 Application Design 4 November 30th, 2004 11:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.