Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 29th, 2011, 01:03 PM
Registered User
 
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Could not find file \www\App_Data\Survey.txt'

Hello,
I created a webform to send to email using chapter 9 instructions (http://www.surroundtech.com/events/msteched/Survey.aspx) and runs perfect on my local computer, however, when I upload (we use godaddy) and try to submit the survey this is the error I receive:

Server Error in '/www' Application.

Could not find file 'D:\Hosting\3714623\html\www\App_Data\Survey.txt'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not find file 'D:\Hosting\3714623\html\www\App_Data\Survey.txt'.

Source Error:


Line 71:
Line 72: string fileName = Server.MapPath("~/App_Data/Survey.txt");
Line 73: string mailBody = File.ReadAllText(fileName);
Line 74:
Line 75: mailBody = mailBody.Replace("##JobTitle##", JobTitle.Text);

Source File: d:\hosting\3714623\html\www\Events\MSTechEd\Survey .aspx.cs Line: 73

Stack Trace:


[FileNotFoundException: Could not find file 'D:\Hosting\3714623\html\www\App_Data\Survey.txt'.]


I had to change the whole site to use 3.5 framework because of compatibility problems at the server - but same error with 4.0.

Not sure why this is happening and if there's a way to fix it.... Thanks,
 
Old March 29th, 2011, 01:12 PM
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,

It looks your site doesn't contain an App_Data folder at the root, or that it contains no Survey.txt file or that the account used by the web server doesn't have permissions to read it.

Can you confirm the file exists? How is your site setup and how do you browse to it? E.g. to what address do you browse?

Also, take a look at this:

File: d:\hosting\3714623\html\www\Events\MSTechEd\Survey .aspx.cs Line: 73
...
[FileNotFoundException: Could not find file 'D:\Hosting\3714623\html\www\App_Data\Survey.txt'.]

There are teo intermediate folders in between there. Looks like Events folder or the MSTechEd folder hasn't been set up as an application.

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 29th, 2011, 01:27 PM
Registered User
 
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Wink That was too easy

Hi Imar,

Just changed the path and it worked... that was so simple, thank you so much for your help.

You are such a genius! I absolutely loved your book, but feel as if I am just in this "copy/paste" mode where no thinking skills are required (or used) ... It's like there's an abyss between now and actually programming an application... maybe I am too old to learn it...
 
Old March 29th, 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

Quote:
maybe I am too old to learn it...
You're never too old to learn. I just takes a lot of practice as it can be complicated at times... ;-)

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
find number of lines in .txt file dgr7 Beginning VB 6 8 July 16th, 2014 05:11 AM
Multiple txt file input to excel in 1 row per file vickyso88 Excel VBA 3 August 24th, 2009 02:11 PM
Chapter11 The SQL database file cannot be created in App_Data folder clark BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 January 15th, 2009 10:29 AM
Can't access local file in App_Data folder VictorVictor ASP.NET 2.0 Professional 8 January 23rd, 2007 10:15 AM





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