Hello all,
I'm not a dotnet user and I'm having a problem changing a root file location to MapPath type from this code I found
I don't know where to edit/change the C:// to something more dynamic since I'll need this for server host purposes.
Thanks!
I'm not a dotnet user and I'm having a problem changing a root file location to MapPath type from this code I found
Code:
<%@ Import Namespace="System.IO"%>
<html>
<head>
<title>File Download</title>
<script language="VB" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim root As String = "C:\temp\"
Dim files() As String = Directory.GetFiles(root)
Dim sb As New StringBuilder(2048)
Dim f As String
For Each f In files
Dim filename As String = Path.GetFileName(f)
sb.Append("<br><a href=FileDownload.aspx?file=")
sb.Append(root).Append(Server.UrlEncode(filename))
sb.Append(">").Append(filename).Append("</a>")
Next
fileList.Text = sb.ToString()
End Sub
</script>
</head>
<body>
<form runat="server">
<asp:Label id="fileList" runat="server"/>
</form>
</body>
</html>
I don't know where to edit/change the C:// to something more dynamic since I'll need this for server host purposes.
Thanks!