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

Our team has recently migrated to git. We have production web application server with
We have a .NET web application installed on our server at the location: C:\Inetpub\fmtool\
I am currently developing Java/GWT-application which is hosted on a weblogic application server. I
Project Description: I have to make an application in android which gets the Latitude
I have an server application (running as a Windows Service) that receives calls from
We need to be sure that our web application and mobile client are communicating
My company has an ERP solution which caters to the retail trade. Therefor besides
We currently have an Java application that can be deployed on clients or run
Here at work we have developed a SOAP WCF API that can be reached
I am writing a code for my homework, I am not so familiar with

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.