Directory.Exists(Application["AppPath"])

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Directory.Exists(Application["AppPath"])

    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!


    Arjen Guest

  2. Similar Questions and Discussions

    1. #39593 [NEW]: XPath NodeList: "Couldn't fetch DOMElement: Node no longer exists"
      From: dave dot lane at gmx dot net Operating system: Linux PHP version: 5.2.0 PHP Bug Type: DOM XML related Bug description:...
    2. "User cannot change pwd" and "Pwd never expire" by using Directory
      I create a account by using the DirectorySerive and it is running: --------------------------------------------------------- Dim ContainerEntry As...
    3. Can't create PS file - "no desktop printer exists for this spool type"
      I can create PDF files from Photoshop, Illustrator or from any eps file by dropping them on to Distiller, but I can't create a ps file. I don't have...
    4. Problem installing a perl module "File exists"
      Hello, i'm trying to install the Date::Simple module, but i have an error: $ tar xvzf Date-Simple-3.01.tar.gz Date-Simple-3.01/...
    5. CLI Application: Still "The database directory cannot be found" - why?
      Hello everybody I used SQLConnect() in my linux cli application to connect to a datasource. But I get this Error SQL1031N The database...
  3. #2

    Default Re: Directory.Exists(Application["AppPath"])

    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" <boah123@hotmail.com> wrote in message
    news:bfu6j0$g3v$1@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!
    >
    >

    Ron Vecchi Guest

  4. #3

    Default Re: Directory.Exists(Application["AppPath"])

    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" <vencenzo@comcast.net> schreef in bericht
    news:#vIbz34UDHA.2288@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" <boah123@hotmail.com> wrote in message
    > news:bfu6j0$g3v$1@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!
    > >
    > >
    >
    >

    Arjen Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139