Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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
 
Old March 22nd, 2011, 02:41 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

That looks like you're using the built-in server and not IIS.

Did you set the Virtual Path to / as explained earlier in the book?

Also,does the path from the error message exist on disk?

Finally, did you move the site?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old March 23rd, 2011, 11:05 AM
Authorized User
 
Join Date: Aug 2010
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
Yes I did set the site to /.
It does exist on disk because this what the error message contains:Could not find a part of the path 'C:\Users\Masego\Documents\My Cell-phone website\Cell-Ware\Cell-Pics\9339d4c5-639a-4dcc-8c78-25c25a347a14.jpg'.I moved the site in to another folder which I created called My cell-phone website but it still gives me the above mentioned error message unless there's another way around this.
 
Old March 23rd, 2011, 11:50 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
It does exist on disk because this what the error message contains:Could not find a part of the path 'C:\Users\Masego\Documents\My Cell-phone website\Cell-Ware\Cell-Pics\9339d4c5-639a-4dcc-8c78-25c25a347a14.jpg
There's no relation between the two. The error message is a DirectoryNotFound exception. The fact you see a full path in the error message doesn't mean the intermediate folder structure exists.

Can you confirm that the entire path up to the file really exists on disk? Try copying the full path and then paste it in the Windows Explorer location bar to confirm.

Otherwise, it's a permissions error.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old March 23rd, 2011, 03:44 PM
Authorized User
 
Join Date: Aug 2010
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes reason being this is how it is exactly saved on disk:'C:\Users\Masego\Documents\My Cell-phone website\Cell-Ware\Cell-Pics.I copied it as you suggested but it doesn't confirm anything as it keeps displaying a blank page.As you mentioned the permissions error.Is there a way on how an where to fix it so that everything works out properly?
 
Old March 23rd, 2011, 04:48 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

A blank page? In Windows Explorer (not Internet Explorer)??

Try moving the site to a path like C:\Site and call the pics folder Pics (e.g. so the images will be stored in C;\Site\Pics). Does it work then?

I think you're mixing up paths and are still using your Documents folder.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old March 24th, 2011, 04:25 PM
Authorized User
 
Join Date: Aug 2010
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No it doesn't.I did everything you suggested from the path(C:\Site)which in the internet explorer when I do the exercise of inserting the pics it clearly shows(C:\Site\Pics)but when the application runs the same error occurs:Could not find a part of the path 'C:\Site\Cell-Ware\Cell-Pics\1dfd5194-2f6d-44d6-b1ac-64b924a80c68.jpg'.An I moved the site out of the documents as well,which is now obviously stored in the local disk(c:).An in the windows explorer the same error message appears.
 
Old March 25th, 2011, 03:58 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Take a look at this:

Quote:
clearly shows(C:\Site\Pics)
and this:

Quote:
C:\Site\Cell-Ware\Cell-Pics
There's still a mismatch between your paths. Somehow, your site wants to store the images in C:\Site\Cell-Ware\Cell-Pics instead of C:\Site\Pics.

This leads me to the following options:

1. Your site is *not* located at C:\Site. E.g. you don't have web.config in C:\Site, but in C:\Site\Cell-Ware

2. Your code doesn't map ~/GigPics or ~/Pics, but ~/Cell-Pics. That should work as well but you then need to change the code that maps the folder.

3. There is still confusion (with you or with me) about what you're mapping and checking. For example:

Quote:
did everything you suggested from the path(C:\Site)which in the internet explorer when I do the exercise of inserting the pics it clearly shows(C:\Site\Pics)
I don't understand this. How do you check a path in Internet Explorer? Aren't you confused with Windows Explorer. Did you check your disk for these paths?
Also, where do you "clearly" see the path C:\Site\Pics? In the debugger? In Windows Explorer? In your code? In the web browser?

So, to fix this once and for all:

1. Explain your site's structure. Tell me where the web.config is located exaclty (in which folder), the .aspx that use to upload the files and so on.

2. Explain what you see in the browser's address bar when you run the site (setting the Virtual Path property on the site changes the address and virtual locations)

3. Show me the code that you use to upload the image and map the "Gigpics" folder or whatever you called it now.

4. Show me the security settings that have been applied to C:\Site\Pics (assuming your site is indeed stored in C:\Site).

Cheers.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old March 31st, 2011, 05:19 PM
Authorized User
 
Join Date: Aug 2010
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My apologise for the confusion.When I referred to the Internet Explorer I meant windows explorer.I checked in the windows and it gave me the very same error message.I see C:\Site\Pics in the dialog box(shown on page 463,in the "browse" text box).

1.My website is mainly structured according to how the book is detailed.The web config is located at the end of my site before the site map(it's not in any folder).

2.By setting the needed changes to the site as the book said.What I see in the browers address bar after I run it:http:// local:53122/ManagePhotoAlbuma.aspx.

3.FileUpload1.SaveAs(System.IO.Path.Combine(physic alFolder,filename + extension));

4.There are no security settings reason being all I did was just rename the folder to "Pics" that's why it appears like that.
 
Old April 1st, 2011, 03:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Maybe I wasn't clear, but I need a lot more information that this. This should be real easy to fix, but somehow you can't seem to provide me with the information I need to fix your problem.

Quote:
My apologise for the confusion.When I referred to the Internet Explorer I meant windows explorer.I checked in the windows and it gave me the very same error message.I see C:\Site\Pics in the dialog box(shown on page 463,in the "browse" text box).
How can that be? How can Windows Explorer give you th exaxct same error message as a run-time Exception in ASP.NET? I find that hard to believe. If you're trying to look up the actual image, it makes sense it isn't there as the image isn't saved. So, open a Windows Explorer, click your C drive. Do you see a Site folder? Double click to open it. What do you see? web.config, ManagePhotoAlbum.aspx and so on? And do you see a Pics folder? If so, double-click it. Does it contain any files?

Quote:
1.My website is mainly structured according to how the book is detailed.The web config is located at the end of my site before the site map(it's not in any folder).
But in which physical folder? How are these files stored on your hard drive? In which folder? And when you choose File | Open Web Site in VWm, which folder do you choose?

Quote:
2.By setting the needed changes to the site as the book said.What I see in the browers address bar after I run it:http:// local:53122/ManagePhotoAlbuma.aspx.
That's good. It means you're using a root-based site which makes things easier.

Quote:
3.FileUpload1.SaveAs(System.IO.Path.Combine(physic alFolder,filename + extension));
Right. But this is really not enough. What does physicalFolder and filename contain? Where do they get a value? What happens when you look at the variables while debugging? I assume you're using MapPath somewhere but which folder do you pass to it?


Quote:
4.There are no security settings reason being all I did was just rename the folder to "Pics" that's why it appears like that.
How do you know there are no security settings? Can you be explicit about what you did? How did you check the security settings and what did you see exactly? Did you follow the instructions in the book?

I am asking a lot of questions, but that's because you're not really providing the information I need. I can't see what you're doing, don't have access to your hard drive and don't know how you set things up. All I know is what you tell me, and things like "There are no security settings" and "the web config is located at the end of my site before the site map" are certainly not explicit enough to help you out.

To summarize how things *should* be (adapted for your situation):

1. You have a folder called C:\Site

2. This folder contains a subfolder called Pics. E.g. C:\Site\Pics

3. The account used by the web server (you, or an IIS account) is able to write to C:\Site\Pics

4. Your site in VWD is setup to look in C:\Site. E.g. you see the webconfig, managephotoalbums etc directly in the root of the site in the Solution Explorer. You also see the Pics folder in VWD

5. You set up the Virtual Path to / This means when you run the site you get something like http://localhost:12345/ManagePhotoAlbum.aspx

6. The code that saves the file to disk uses something like this:

Code:
 
C#
string virtualFolder = "~/Pics/";
string physicalFolder = Server.MapPath(virtualFolder);

VB
Dim virtualFolder As String = "~/Pics/"
Dim physicalFolder As String = Server.MapPath(virtualFolder)
Where, ~/Pics is made physical by MapPath. It should return C:\Site\Pics, or one of the earlier requirements in this list are not met.

Now, if you keep having troubles with this, try to describe the past 6 points the way they are set up on your system, and please, please, be explicit and crystal clear.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 7th, 2011, 04:56 PM
Authorized User
 
Join Date: Aug 2010
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Regarding the previous point 4 about the security settings,I didnt understand the question.So how do I check the books security settings that should be applied to my site?



1.Yes.C:\Site which is located in my Local Disk(C:) which has my cell-ware site in it.

2.Yes called Pics and this is how it is displayed on my Laptop:Computer-Local Disk(C:)-Site-Cell-Ware-Pics.

3.I'am honestly not sure what account is used by the web server an may I ask how do I go about checking what it is.

4.It is setup like C:\Site\Cell-Ware,where the webconfig located in the root of the site second from the bottom as well as the other folders and aspx templates exactly of the book instructed.The Pics folder is in the site as it is located under my masterpages folder.All of the above mentioned are in the solution explorer

5.I did what the book instructed me to do regarding the virtual path as this is what the managephotoalbum.aspx displays after running it:http://localhost:53122/ManagePhotoAlbumaspx.

6.This is the code that saves the file to disk:string virtualFolder = "~/Cell-Pics/";
string physicalFolder = Server.MapPath(virtualFolder);

If I wasn't clear on any of the point,please let me know.I do apologise if I'am not clear enough as the delay is really frustrating me.I honestly don't mind the amount of questions ask as they shed indication of my faults





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 13,page 440. Masego.Moikanyang BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 March 17th, 2011 10:45 AM
Chapter 13, Page 465 Try it Out dstreeter BOOK: Beginning ASP.NET 4 : in C# and VB 3 November 7th, 2010 10:41 AM
page 456, chapter 13. leemark2k3 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 8 September 21st, 2010 08:21 PM





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