Public ReadOnly Property StorageRoot() As String
Get
Dim filepath As String = HttpContext.Current.Server.MapPath("/CaseStudyImages/" & HttpContext.Current.Request.QueryString("id") & "/")
' Check if folder exists, if not create it
If Not Directory.Exists(filepath) Then
Directory.CreateDirectory(Path.GetDirectoryName(filepath))
' Folder created message
End If
'ConfigurationManager.AppSettings["StorageRoot"];
Return filepath
End Get
End Property
hi,CaseStudy is folder:just check inside casestudy if folder with name of id name does not exits create it.it works for vb.net
Smadhu
Member
510 Points
989 Posts
Function to check folder exists or not if not create it
Feb 02, 2012 05:12 AM|LINK
Public ReadOnly Property StorageRoot() As String Get Dim filepath As String = HttpContext.Current.Server.MapPath("/CaseStudyImages/" & HttpContext.Current.Request.QueryString("id") & "/") ' Check if folder exists, if not create it If Not Directory.Exists(filepath) Then Directory.CreateDirectory(Path.GetDirectoryName(filepath)) ' Folder created message End If 'ConfigurationManager.AppSettings["StorageRoot"]; Return filepath End Get End Propertyhi,CaseStudy is folder:just check inside casestudy if folder with name of id name does not exits create it.it works for vb.net
Enjoy the code it simple n easy