Wie w�re es mit:

HttpContext.Current.Request.ApplicationPath

?

bzw.

Page.Request.ApplicationPath

je nachdem wo Du bist.

-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Bj�rn Sievers
Gesendet: Freitag, 19. November 2004 14:24
An: [EMAIL PROTECTED]
Betreff: AW: [Asp.net] Was benutzt man nun statt Dir

OK, soweit so gut. Wie erhalte ich jetzt den aktuellen Pfad meiner
Webanwendung? Gibt es bei der GetFiles die M�glichkeit zwei Patterns
einzugeben z.B. *.gif|*.jpg?

-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Auftrag von Loprete, Marco
Gesendet: Freitag, 19. November 2004 11:27
An: '[EMAIL PROTECTED]'
Betreff: AW: [Asp.net] Was benutzt man nun statt Dir


Die Klasse, die Du suchst heisst "DirectoryInfo" im Namespace "System.IO"

Gruss

Marco


> -----Urspr�ngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Gesendet: Freitag, 19. November 2004 11:18
> An: [EMAIL PROTECTED]
> Betreff: AW: [Asp.net] Was benutzt man nun statt Dir
>
> Boah... Da muss ich erst mal gucken, was ich davon gebrauchen kann.
> Danke schonmal!
>
> -----Ursprungliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Auftrag von Andreas Roth
> Gesendet: Freitag, 19. November 2004 11:11
> An: [EMAIL PROTECTED]
> Betreff: AW: [Asp.net] Was benutzt man nun statt Dir
>
>
> Da stecken alle Objekte drin:
>
> using System;
> using System.IO;
> using System.Windows.Forms;
> using System.Collections;
>
> namespace RecursiveFileExplorer
> {
>       public class FileExplorer
>       {
>               public ArrayList FileList = new ArrayList();
>               public ArrayList Extensions = null;
>               private string Path = "";
>               private bool Recursive = true;
>
>               /// <summary>
>               /// Constructor called if filepath argument given.
>               /// </summary>
>               /// <param name="filepath">Initial path to search
> from.</param>
>               public FileExplorer( string path  )
>               {
>                       this.Path = path;
>                       this.Recursive = false;
>                       this.FileList = this.getFiles();
>               }
>
>               /// <summary>
>               /// Constructor called if filepath and extensions arguments
> given.
>               /// </summary>
>               /// <param name="filepath">Initial path to search
> from.</param>
>               /// <param name="extensions">Arraylist of file extensions to
> filter results by.</param>
>               public FileExplorer( string path, ArrayList extensions  )
>               {
>                       this.Path = path;
>                       this.Extensions = extensions;
>                       this.Recursive = false;
>                       this.FileList = this.getFiles();
>               }
>
>               /// <summary>
>               /// Constructor called if filepath and recursive arguments
> given.
>               /// </summary>
>               /// <param name="filepath">Initial path to search
> from.</param>
>               /// <param name="recursive">Specifies whether to use
> recursion to search sub-folders.</param>
>               public FileExplorer( string path, bool recursive  )
>               {
>                       this.Path = path;
>                       this.Recursive = recursive;
>                       this.FileList = this.getFiles();
>               }
>
>               /// <summary>
>               /// Constructor called if filepath, extensions and recursive
> arguments given.
>               /// </summary>
>               /// <param name="filepath">Initial path to search
> from.</param>
>               /// <param name="extensions">Arraylist of file extensions to
> filter results by.</param>
>               /// <param name="recursive">Specifies whether to use
> recursion to search sub-folders.</param>
>               public FileExplorer( string path, ArrayList extensions, bool
> recursive  )
>               {
>                       this.Path = path;
>                       this.Extensions = extensions;
>                       this.Recursive = recursive;
>                       this.FileList = this.getFiles();
>               }
>
>               /// <summary>
>               /// Searches through directory and sub-directories for
> files.
>               /// </summary>
>               /// <returns>ArrayList of files found.</returns>
>               public ArrayList getFiles()
>               {
>                       DirectoryInfo   dir = new DirectoryInfo( this.Path
> );
>                       FileInfo[]      files;
>                       DirectoryInfo[] dirs;
>                       ArrayList List = new ArrayList();
>
>                       //if the source dir doesn't exist, throw
>                       if (! dir.Exists)
>                       {
>                               throw new Exception("Source directory
> doesn't exist: " + this.Path );
>                       }
>
>                       //get all files in the current dir
>                       files = dir.GetFiles();
>
>                       //loop through each file
>                       foreach(FileInfo file in files)
>                       {
>                               if( this.Extensions == null )
>                               {
>                                       List.Add( new FileData(
> file.FullName, file.Name, file.Extension, file.Length ) );
>                               }
>                               else
>                               {
>                                       if( this.checkFile( file.Extension )
> )
>                                       {
>                                               List.Add( new FileData(
> file.FullName, file.Name, file.Extension, file.Length ) );
>                                       }
>                               }
>                       }
>
>                       //cleanup
>                       files = null;
>
>                       //if not recursive, all work is done
>                       if (! this.Recursive)
>                       {
>                               return List;
>                       }
>
>                       //otherwise, get dirs
>                       dirs = dir.GetDirectories();
>
>                       //loop through each sub directory in the current dir
>                       foreach(DirectoryInfo subdir in dirs)
>                       {
>                               this.Path = subdir.FullName;
>                               ArrayList temp = new ArrayList();
>                               temp = getFiles();
>                               for(int i=0; i < temp.Count; i++)
>                               {
>                                       FileData TempData =
> (FileData)temp[i];
>                                       List.Add( new FileData(
> TempData.FullName, TempData.Name, TempData.Extension, TempData.Length ) );
>                               }
>                       }
>
>                       //cleanup
>                       dirs = null;
>
>                       dir = null;
>
>                       return List;
>               }
>
>               /// <summary>
>               /// Matches current file extension against given file
> extension.
>               /// </summary>
>               /// <param name="strExtension">Extension to match
> against.</param>
>               /// <returns>Whether current file extension matches given
> file extension.</returns>
>               private bool checkFile( string strExtension )
>               {
>                       bool throwaway = true;
>                       for(int j=0; j<this.Extensions.Count; j++)
>                       {
>                               if( this.Extensions[j].ToString() ==
> strExtension )
>                               {
>                                       throwaway = false;
>                               }
>                       }
>
>                       if( throwaway )
>                       {
>                               return false;
>                       }
>                       else
>                       {
>                               return true;
>                       }
>               }
>
>       }
> }
>
>
> _______________________________________________
> Asp.net Mailingliste, Postings senden an:
> [EMAIL PROTECTED]
> An-/Abmeldung und Suchfunktion unter:
> http://www.glengamoi.com/mailman/listinfo/asp.net
>
> _______________________________________________
> Asp.net Mailingliste, Postings senden an:
> [EMAIL PROTECTED]
> An-/Abmeldung und Suchfunktion unter:
> http://www.glengamoi.com/mailman/listinfo/asp.net
_______________________________________________
Asp.net Mailingliste, Postings senden an:
[EMAIL PROTECTED]
An-/Abmeldung und Suchfunktion unter:
http://www.glengamoi.com/mailman/listinfo/asp.net

_______________________________________________
Asp.net Mailingliste, Postings senden an:
[EMAIL PROTECTED]
An-/Abmeldung und Suchfunktion unter:
http://www.glengamoi.com/mailman/listinfo/asp.net

_______________________________________________
Asp.net Mailingliste, Postings senden an:
[EMAIL PROTECTED]
An-/Abmeldung und Suchfunktion unter:
http://www.glengamoi.com/mailman/listinfo/asp.net

Antwort per Email an