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

  • Home
  • SEARCH
  • 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 5848053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:48:20+00:00 2026-05-22T12:48:20+00:00

Our application server has a folder used to store attachments uploaded by customer. This

  • 0

Our application server has a folder used to store attachments uploaded by customer. This folder is called Attachments which is out of website, no virtual directory for this folder. I wonder how to link files of this folder.
My code is :

string vetting = "c:\\Attachments";
if (Directory.Exists(vetting +"\\"+ "UserName"))
        {

            DirectoryInfo di = new DirectoryInfo(vetting+"\\" + "UserName");
            FileInfo[] rgFiles = di.GetFiles("*.*");
            if (rgFiles.Length > 0)//thumb.db will be a file
            {//list is a div on front end.
                list.InnerHtml += <span class='SubTitle'>Your attachments list:</span>";
                foreach (FileInfo fi in rgFiles)
                {
                    list.InnerHtml += "<br><a href='c:/Attachments/UserName/"+fi.Name+"'>"+fi.Name+"</a>" ;
                }
            }
            else
            {
                list.InnerHtml += "You don't have any attachment yet.";
            }
        }

But it doesn’t work, it always goes to find the client side c:/Attachments. How could I link to server side c:/Attachments? Thank you 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-05-22T12:48:21+00:00Added an answer on May 22, 2026 at 12:48 pm

    You cannot link to those files if they’re not exposed to IIS (your web server).

    Suggest 2 options to consider:

    • create an .ashx (ASP.NET web handler)to handle these requests. It would read the requested document (either from session, cookie, or querystring) as you see fit. Your .InnerHtml can be <a href='mysite.com/bar.ashx?file=foo'>foo.xlsx</a>. You can then implement authorization checks, file name obfuscation, and a whole lot more. Read the bytes of the desired file, and return to the client.

    • create a virtual directory under your IIS site/application. Call this vdir ‘attachments’. Warning: this lets anyone use/build/consume any link to view any attachment. Consider disabling directory browsing. Ensure that the appropriate IIS user has NTFS permissions to view this directory. Implement this if security isn’t a concern/requirement. Your .InnerHtml can then be <a href='mysite.com/attachments/foo.xlsx'>foo.xlsx</a>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We need to build an administration portal website to support our client/server application. Since
Our server application is listening on a port, and after a period of time
In our application, we are using RMI for client-server communication in very different ways:
I have a web reference for our report server embedded in our application. The
I have an existing SQL Server 2005 database that runs our accounting/inventory application. We
We're currently using IIS 6 and Windows Server 2003 for our web and application
I'm creating an ASP.NET web application to schedule tasks on our server from a
Recently, I started changing some of our applications to support MS SQL Server as
We have very strange problem, one of our applications is continually querying server by
I am currently working on a server control for other applications in our company

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.