Folder Listing
-
Hi I am trying to List a folder Items which is in C:/ and my .aspx file is in server My code ------ Public Shared al As ArrayList al = New ArrayList Dim FtpUpFiles() As String If Directory.Exists("c:/songs/") Then FtpUpFiles = Directory.GetFiles("c:/songs/") If FtpUpFiles.Length > 0 Then Dim i As Integer For i = 0 To FtpUpFiles.Length - 1 al.Add(FtpUpFiles(i).ToString.Remove(0, FtpUpFiles(i).ToString.LastIndexOf("\") + 1)) Next al.Sort() dgUp1.Visible = True dgUp1.DataSource = al dgUp1.DataBind() End If ------------------ It is working in Local fine But not in the server How can access the folder form server Than Q Keerthi
-
Hi I am trying to List a folder Items which is in C:/ and my .aspx file is in server My code ------ Public Shared al As ArrayList al = New ArrayList Dim FtpUpFiles() As String If Directory.Exists("c:/songs/") Then FtpUpFiles = Directory.GetFiles("c:/songs/") If FtpUpFiles.Length > 0 Then Dim i As Integer For i = 0 To FtpUpFiles.Length - 1 al.Add(FtpUpFiles(i).ToString.Remove(0, FtpUpFiles(i).ToString.LastIndexOf("\") + 1)) Next al.Sort() dgUp1.Visible = True dgUp1.DataSource = al dgUp1.DataBind() End If ------------------ It is working in Local fine But not in the server How can access the folder form server Than Q Keerthi
kirthikirthi wrote:
Directory.Exists("c:/songs/")
try following code
Directory.Exists(Server.MapPath("c:/songs/"))
best regard pathan
-
Hi I am trying to List a folder Items which is in C:/ and my .aspx file is in server My code ------ Public Shared al As ArrayList al = New ArrayList Dim FtpUpFiles() As String If Directory.Exists("c:/songs/") Then FtpUpFiles = Directory.GetFiles("c:/songs/") If FtpUpFiles.Length > 0 Then Dim i As Integer For i = 0 To FtpUpFiles.Length - 1 al.Add(FtpUpFiles(i).ToString.Remove(0, FtpUpFiles(i).ToString.LastIndexOf("\") + 1)) Next al.Sort() dgUp1.Visible = True dgUp1.DataSource = al dgUp1.DataBind() End If ------------------ It is working in Local fine But not in the server How can access the folder form server Than Q Keerthi
If you mean that you want to access the folder on your computer from the server, that is not possible.
--- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams
-
Hi I am trying to List a folder Items which is in C:/ and my .aspx file is in server My code ------ Public Shared al As ArrayList al = New ArrayList Dim FtpUpFiles() As String If Directory.Exists("c:/songs/") Then FtpUpFiles = Directory.GetFiles("c:/songs/") If FtpUpFiles.Length > 0 Then Dim i As Integer For i = 0 To FtpUpFiles.Length - 1 al.Add(FtpUpFiles(i).ToString.Remove(0, FtpUpFiles(i).ToString.LastIndexOf("\") + 1)) Next al.Sort() dgUp1.Visible = True dgUp1.DataSource = al dgUp1.DataBind() End If ------------------ It is working in Local fine But not in the server How can access the folder form server Than Q Keerthi
This is not possible, because ASP.NET can access the directories which is located in side the virtual directory or allowed space.