ASP.NET - Crear un directorio en el Servidor

Written by lopezatienza on 27 Enero 2009 – 11:39 -

Nos creamos una variable Path, que contendrá la ruta del Servidor donde se esté ejecutando nuestra aplicación.

  1. string Path = HttpContext.Current.Server.MapPath("");

Preguntamos si existe el directorio, y si no es así, lo creamos.

  1. if (!System.IO.Directory.Exists(Path + @"\Nombre_Directorio"))
  2. {
  3. System.IO.Directory.CreateDirectory(Path + @"\ Nombre_Directorio ");
  4. }

Tags:
Posted in ASP.NET |

Leave a Comment

RSS