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 770347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:29:07+00:00 2026-05-14T18:29:07+00:00

I am writing an ASP application that will serve files to clients through the

  • 0

I am writing an ASP application that will serve files to clients through the browser. The files are located on a file server that is available from the machine IIS is running on via a UNC path (\server\some\path).

I want to use something like the code below to serve the file. Serving files that are local to the machine IIS is running on is working well with this method, my trouble is being able to serve files from the UNC mapped share:

//Set the appropriate ContentType.
Response.ContentType = "Application/pdf";

//Get the physical path to the file.
string FilePath = MapPath("acrobat.pdf");

//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();

My question is how I can specify a UNC path for the file name. Also, to access the file share I need to connect with a specific username/password.

I would appreciate some pointers on how I can achieve this (either using the approach above or by other means).

  • 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-14T18:29:08+00:00Added an answer on May 14, 2026 at 6:29 pm

    I’m not an ASP guy so I might be completely wrong with these answers.

    Regarding the path, I don’t think you should be using MapPath, since that’s to get a relative path and you already know the physical path so can’t you just change that to:

    string FilePath = @"\\Server\Directory\FileName.txt";
    

    Regarding the account, I think you need to use impersonation, this link seems to discuss just this:

    http://aspalliance.com/336_Upload_Files_Using_ASPNET_Impersonation_and_UNC_Share.all

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

Sidebar

Related Questions

I am writing an ASP.NET application that will keep track of bandwidth being used
I am writing an API for my ASP.NET application that other developers will use.
I am writing an application that downloads large files in the background. All clients
I'm writing an ASP.NET web application which will run on Windows Server 2008 (IIS7).
I'm writing an ASP.net application that uses Windows Identity Foundation. My ASP.net application uses
I am writing a web application on Asp.Net MVC 3. Assume that we have
We are writing an ASP.NET MVC application. By default, if the client browser has
I am planning on writing a medium size web application that will be XML
I'm writing a web application that will have plugins. The plugins will be .DLL
I am being tasked with writing an asp.net web app that will use ADFS

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.