473,498 Members | 891 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing Files In 'App_Data' Folder

asp.net 2/C#/VS2005

I have a web app where I use a stream writer to create a CSV (text)
file. I then use my code to save the file in the site's 'App_Data'
folder, in a subfolder called 'Temp'. Finally, I redirect the page to
that file in order to serve it out (push the download) to the user.
This all worked great in .net v1.1.

Now, in my new .net v2 app, everytime the page redirect occurs, the
browser displays "The webpage cannot be found." I have verified that
the file is located in 'App_Data' folder. I have also verified that
the redirect is going to the correct URL. I even tried manually typing
the URL ("http://localhost/App_Data/Temp/MyFile.csv") into the browser
- same result.

I also thought this problem might be occurring due to IIS not having a
mapping for the CSV filetype, so went to the IIS snap in and added it.
I basically used the same aspnet DLL file and verbs as for the aspx
pages. After stopping and restarting the site, it still gives the "The
webpage cannot be found" message.

What can I do to make this work?

May 31 '07 #1
4 24289
On May 31, 3:36 pm, Joey <joey.pow...@topscene.comwrote:
asp.net 2/C#/VS2005

I have a web app where I use a stream writer to create a CSV (text)
file. I then use my code to save the file in the site's 'App_Data'
folder, in a subfolder called 'Temp'. Finally, I redirect the page to
that file in order to serve it out (push the download) to the user.
This all worked great in .net v1.1.

Now, in my new .net v2 app, everytime the page redirect occurs, the
browser displays "The webpage cannot be found." I have verified that
the file is located in 'App_Data' folder. I have also verified that
the redirect is going to the correct URL. I even tried manually typing
the URL ("http://localhost/App_Data/Temp/MyFile.csv") into the browser
- same result.

I also thought this problem might be occurring due to IIS not having a
mapping for the CSV filetype, so went to the IIS snap in and added it.
I basically used the same aspnet DLL file and verbs as for the aspx
pages. After stopping and restarting the site, it still gives the "The
webpage cannot be found" message.

What can I do to make this work?
Why are you saving into App_Data? App_Data is a system .NET folder
and those files are protected in there.

Just create a regular folder and save them in there.

May 31 '07 #2

I concur.

Don't use App_Data for temp files.

App_Data would have:
myaccess.mdb
myfile.xml
sqlexpressfile.db (whats the extension??)

type files in it. Not temp files.


"Larry Bud" <la**********@yahoo.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
On May 31, 3:36 pm, Joey <joey.pow...@topscene.comwrote:
asp.net 2/C#/VS2005

I have a web app where I use a stream writer to create a CSV (text)
file. I then use my code to save the file in the site's 'App_Data'
folder, in a subfolder called 'Temp'. Finally, I redirect the page to
that file in order to serve it out (push the download) to the user.
This all worked great in .net v1.1.

Now, in my new .net v2 app, everytime the page redirect occurs, the
browser displays "The webpage cannot be found." I have verified that
the file is located in 'App_Data' folder. I have also verified that
the redirect is going to the correct URL. I even tried manually typing
the URL ("http://localhost/App_Data/Temp/MyFile.csv") into the browser
- same result.

I also thought this problem might be occurring due to IIS not having a
mapping for the CSV filetype, so went to the IIS snap in and added it.
I basically used the same aspnet DLL file and verbs as for the aspx
pages. After stopping and restarting the site, it still gives the "The
webpage cannot be found" message.

What can I do to make this work?

Why are you saving into App_Data? App_Data is a system .NET folder
and those files are protected in there.

Just create a regular folder and save them in there.

May 31 '07 #3
On May 31, 2:47 pm, "sloan" <s...@ipass.netwrote:
I concur.

Don't use App_Data for temp files.

App_Data would have:
myaccess.mdb
myfile.xml
sqlexpressfile.db (whats the extension??)

type files in it. Not temp files.

"Larry Bud" <larrybud2...@yahoo.comwrote in message

news:11**********************@q75g2000hsh.googlegr oups.com...
On May 31, 3:36 pm, Joey <joey.pow...@topscene.comwrote:
asp.net 2/C#/VS2005
I have a web app where I use a stream writer to create a CSV (text)
file. I then use my code to save the file in the site's 'App_Data'
folder, in a subfolder called 'Temp'. Finally, I redirect the page to
that file in order to serve it out (push the download) to the user.
This all worked great in .net v1.1.
Now, in my new .net v2 app, everytime the page redirect occurs, the
browser displays "The webpage cannot be found." I have verified that
the file is located in 'App_Data' folder. I have also verified that
the redirect is going to the correct URL. I even tried manually typing
the URL ("http://localhost/App_Data/Temp/MyFile.csv") into the browser
- same result.
I also thought this problem might be occurring due to IIS not having a
mapping for the CSV filetype, so went to the IIS snap in and added it.
I basically used the same aspnet DLL file and verbs as for the aspx
pages. After stopping and restarting the site, it still gives the "The
webpage cannot be found" message.
What can I do to make this work?
Why are you saving into App_Data? App_Data is a system .NET folder
and those files are protected in there.
Just create a regular folder and save them in there.- Hide quoted text -

- Show quoted text -
Okay, maybe I am misunderstanding something here. In the old asp.net
v1.1 app, I did just what you said. I created sub folders off of
whatever folders contained the webpages, and then I put my files in
there before redirecting to them. Like I said, that used to work
great.

Then a few weeks ago I started working with asp.net v2. When I tried
that same approach, I kept losing Session data everytime I deleted/
(and wrote?) files to those same old temp folders.

After troubleshooting this, I found out that in asp.net v2 when one
deletes/(and writes?) files/folders outside of the App_Data folder, it
causes something called an AppDomain restart - and this invalidates
all Session data. THIS IS HUGE!!!

For this reason, I started moving all of my stuff to the App_Data
folder.

So you guys are saying you have never heard about the AppDomain
restart problem before? Has anyone else heard of it?

If I can't write and delete files outside of the App_Data folder, and
I can't do it inside of the App_Data folder either, where else is
left?

Any suggestions/feedback/comments are appreciated.

Thanks,
JP

May 31 '07 #4

Hmm.

I see your issue and concur it is a signficant one.

However, I have deployed an app in 2.0 where I did what (we) described.

My was

/root/
/root/Reports/
/root/Reports/TempReportFiles/

and I was creating files in there. And didn't suffer the restart issue.

Are you running the built in webserver, or using IIS?

Try going to IIS and see if you get the same issues.

(Aka, you won't have mydevelpmentsite:5097/ port number thing in IIS)

Its under the project properties (to change to IIS)

"Joey" <jo*********@topscene.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
On May 31, 2:47 pm, "sloan" <s...@ipass.netwrote:
I concur.

Don't use App_Data for temp files.

App_Data would have:
myaccess.mdb
myfile.xml
sqlexpressfile.db (whats the extension??)

type files in it. Not temp files.

"Larry Bud" <larrybud2...@yahoo.comwrote in message

news:11**********************@q75g2000hsh.googlegr oups.com...
On May 31, 3:36 pm, Joey <joey.pow...@topscene.comwrote:
asp.net 2/C#/VS2005
I have a web app where I use a stream writer to create a CSV (text)
file. I then use my code to save the file in the site's 'App_Data'
folder, in a subfolder called 'Temp'. Finally, I redirect the page
to
that file in order to serve it out (push the download) to the user.
This all worked great in .net v1.1.
Now, in my new .net v2 app, everytime the page redirect occurs, the
browser displays "The webpage cannot be found." I have verified that
the file is located in 'App_Data' folder. I have also verified that
the redirect is going to the correct URL. I even tried manually
typing
the URL ("http://localhost/App_Data/Temp/MyFile.csv") into the
browser
- same result.
I also thought this problem might be occurring due to IIS not having
a
mapping for the CSV filetype, so went to the IIS snap in and added
it.
I basically used the same aspnet DLL file and verbs as for the aspx
pages. After stopping and restarting the site, it still gives the
"The
webpage cannot be found" message.
What can I do to make this work?
Why are you saving into App_Data? App_Data is a system .NET folder
and those files are protected in there.
Just create a regular folder and save them in there.- Hide quoted
text -

- Show quoted text -

Okay, maybe I am misunderstanding something here. In the old asp.net
v1.1 app, I did just what you said. I created sub folders off of
whatever folders contained the webpages, and then I put my files in
there before redirecting to them. Like I said, that used to work
great.

Then a few weeks ago I started working with asp.net v2. When I tried
that same approach, I kept losing Session data everytime I deleted/
(and wrote?) files to those same old temp folders.

After troubleshooting this, I found out that in asp.net v2 when one
deletes/(and writes?) files/folders outside of the App_Data folder, it
causes something called an AppDomain restart - and this invalidates
all Session data. THIS IS HUGE!!!

For this reason, I started moving all of my stuff to the App_Data
folder.

So you guys are saying you have never heard about the AppDomain
restart problem before? Has anyone else heard of it?

If I can't write and delete files outside of the App_Data folder, and
I can't do it inside of the App_Data folder either, where else is
left?

Any suggestions/feedback/comments are appreciated.

Thanks,
JP

May 31 '07 #5

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

Similar topics

0
1622
by: coolcajun | last post by:
I want to open and read a file in the App_Data folder from my web application. Has anyone done this? If so how? My main problem is coming with the path for the file.
3
1726
by: Sushi | last post by:
Hi I am developing an application using ASP.Net 2.0. In my code under App_Code I would like to access the files in App_Data. Any ideas if there is a way to get the path of this folder ? Thanks
4
1416
by: Rush | last post by:
I'm new to web development in Visual Studio 2005, and I'm creating a web site using ASP.NET, and right now its a very simple page with only labels on it. I have a third party that hosts the site,...
3
4119
by: jason | last post by:
I've been playing around with new (for 2.0) membershp functionality. I was able to build a simple login form that secures a directory on a project I built locally on my development desktop. ...
2
2136
by: le0 | last post by:
guys, this is my first time to deploy website to the server, but every time i access the page this error always appears. ...
5
3421
by: wwwmike | last post by:
I have an asp.net 2.0 application where I move about 200,000 text files daily in and out. When using VS 2005 to debug my application everything works find if only a few files are in the folder....
3
1935
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
Is it always necessary to upload to the host, the App_Data folder if my db does not reside in that folder? -- L. A. Jones
1
2803
by: =?Utf-8?B?U3VzaGlTZWFu?= | last post by:
I have problems with sharing files from this directory. It is system directory so I can't make dirrect links on files inside. For example /App_Data/my.mp3 www.example.com/App_Data/my.mp3 -...
2
2490
by: Frank | last post by:
Hi, Originally I was planning to do some code reuse (yeah.. that exists..didn't want to believe it either) with some class library projects that I now want to use in a asp.net 2.0 web app in VS...
0
6998
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...
0
7163
Oralloy
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,...
1
6884
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...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4586
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...
0
3090
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...
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
287
bsmnconsultancy
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...

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.