Directory.Exists(Application["AppPath"])

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Arjen

    #1

    Directory.Exists(Application["AppPath"])

    Hello,

    I want to check if an directory exist.
    Directory.Exist s(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

    #2
    Re: Directory.Exist s(Application["AppPath&q uot;])

    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.Http Appliction["MyAppVar"]


    "Arjen" <boah123@hotmai l.com> wrote in message
    news:bfu6j0$g3v $1@news2.tilbu1 .nb.home.nl...[color=blue]
    > Hello,
    >
    > I want to check if an directory exist.
    > Directory.Exist s(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!
    >
    >[/color]


    Comment

    • Arjen

      #3
      Re: Directory.Exist s(Application[&quot;AppPath&q uot;])

      The message that I get now is:
      'System.Web.Htt pApplication' denotes a 'class' where a 'variable' was
      expected

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



      Why?



      "Ron Vecchi" <vencenzo@comca st.net> schreef in bericht
      news:#vIbz34UDH A.2288@TK2MSFTN GP12.phx.gbl...[color=blue]
      > 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.Http Appliction["MyAppVar"]
      >
      >
      > "Arjen" <boah123@hotmai l.com> wrote in message
      > news:bfu6j0$g3v $1@news2.tilbu1 .nb.home.nl...[color=green]
      > > Hello,
      > >
      > > I want to check if an directory exist.
      > > Directory.Exist s(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!
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...