I let users upload files using the asp.net upload control. I have a repeater on a page that list the files and users can click to download them:
protected void grdFiles_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType != DataControlRowType.DataRow) return;
var fileNameFull = Common.FileHelper.UploadPath + e.Row.Cells[0].Text;
Request.MapPath(fileNameFull);
var hyp = new HyperLink
{
NavigateUrl = fileNameFull,
Text = e.Row.Cells[0].Text,
};
e.Row.Cells[0].Controls.Add(hyp);
}
this works fine when the files are on the same drive as the web application, fileNameFull looks like: ~\Uploads\some pdf.pdf
The requirement now is that files are going to be stored on a different drive so my question is how can I achieve this? Request.MapPath obviously expects a virtual path.
The files needs to be exposed to users over the web, security is not the main concern.
Thanks in advance.