By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,682 Members | 1,987 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,682 IT Pros & Developers. It's quick & easy.

Directory.Exists(Application["AppPath"])

P: n/a
Hello,

I want to check if an directory exist.
Directory.Exists(Application["AppPath"] + "/Uploads/")

I'm doing this inside a asp.net web project in a class file.

Here is the error message.
The name 'Application' does not exist in the class or namespace.

What kind of namespace do I have to include?
Or are there other options to get the application path?

Thanks!
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
if your accessing the Application object from a seperate class file not
inheriting from Page or UserControl
you need to reference it as System.Web.HttpAppliction["MyAppVar"]
"Arjen" <bo*****@hotmail.com> wrote in message
news:bf**********@news2.tilbu1.nb.home.nl...
Hello,

I want to check if an directory exist.
Directory.Exists(Application["AppPath"] + "/Uploads/")

I'm doing this inside a asp.net web project in a class file.

Here is the error message.
The name 'Application' does not exist in the class or namespace.

What kind of namespace do I have to include?
Or are there other options to get the application path?

Thanks!

Nov 17 '05 #2

P: n/a
The message that I get now is:
'System.Web.HttpApplication' denotes a 'class' where a 'variable' was
expected

When using this code:
System.Web.HttpApplication["AppPath"]

Why?

"Ron Vecchi" <ve******@comcast.net> schreef in bericht
news:#v**************@TK2MSFTNGP12.phx.gbl...
if your accessing the Application object from a seperate class file not
inheriting from Page or UserControl
you need to reference it as System.Web.HttpAppliction["MyAppVar"]
"Arjen" <bo*****@hotmail.com> wrote in message
news:bf**********@news2.tilbu1.nb.home.nl...
Hello,

I want to check if an directory exist.
Directory.Exists(Application["AppPath"] + "/Uploads/")

I'm doing this inside a asp.net web project in a class file.

Here is the error message.
The name 'Application' does not exist in the class or namespace.

What kind of namespace do I have to include?
Or are there other options to get the application path?

Thanks!


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.