Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8410911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:18:10+00:00 2026-06-10T00:18:10+00:00

I let users upload files using the asp.net upload control. I have a repeater

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:18:12+00:00Added an answer on June 10, 2026 at 12:18 am

    You can’t create a hyperlink to a file that is not hosted within the web site. But you can create an http handler to serve the file. The http handler could accept an identifier for the file in the query string and write the file out to the response:

    public class YourHttpHandler: IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            string filePath = Common.FileHelper.UploadPath + context.Request.QueryString["file"];
            context.Response.ContentType = "your content type";
            context.Response.WriteFile(filePath);
        }
    
        public bool IsReusable
        {
            get { return false; }
        }
    }
    

    Then in the bind event of your page, you could set the NavigateUrl to the handler, with an identifier for the file in the query string. Something like this:

    var hyp = new HyperLink
                          {
                              NavigateUrl = "~/YourHttpHandler.ashx?file=" + e.Row.Cells[0].Text,
                              Text = e.Row.Cells[0].Text,
                          };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let say, I have a web application that allows users to upload images and
I develop a web application that let users to upload files like images and
I let users to upload photos. User can upload multiple photos at once using
I'm developing a Web application that will let users upload images. My concern is
I'm using CodeIgniter + Zend libraries. I want to let users upload videos to
I'm working on an app that will let users submit zip files that are
here is a site http://www.lyrkjsw.gov.cn that can let the registered user to upload file
Let's say that I'm setting up an upload feature for a project. I'm using
I am using Uploadify plugin for asp.net web appication. I want to let user
I'm curious how to upload file through FTP using PHP. Let's say I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.