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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:18:43+00:00 2026-05-21T14:18:43+00:00

Our webapp is able to download files from Sharepoint and surface them to the

  • 0

Our webapp is able to download files from Sharepoint and surface them to the user, but only if I provide my personal username and password to the process. I received a suggestion that: we “should use the credentials of the AppPool (UseDefaultCredentials=True.)”

What changes do I make to for this to work with UseDefaultCredentials=True? And what is UseDefaultCredentials=true?

string documentName = null;
string contentType = "unknown";

// We don't want to use this method of credentials
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("USERNAME", "PASSWORD");

ClientContext clientContext = new ClientContext("http://MOSSSERVER/MYDIRECTORY");
clientContext.Credentials = cred;

FileInformation fileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, reference);

documentName = Path.GetFileName(reference);

return new FileStreamResult(fileInformation.Stream, contentType)
{
  FileDownloadName = documentName
};
  • 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-21T14:18:43+00:00Added an answer on May 21, 2026 at 2:18 pm

    Check out this question:

    Getting NetworkCredential for current user (C#)

    If you can just get the client context to use the credentials of the process that is running it then you will be using the credentials of the application pool. It might use the current user context by default if you don’t provide any credentials.

    You will need to be sure that the application pool credentials have access to the file as well. You can configure the application pool user in IIS under advanced settings of the application pool and choose a user that has access to the share point files.

    If you are just running in the context of visual studio then the current logged in user will be set to the default credentials.

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

Sidebar

Related Questions

I have a little payments webApp, our customers can install it on their IIS
in our web-app project, we include some jar files. For patching some issues of
We want to encrypt all our web app configuration files that we deploy to
We have an in-house webapp running for internal use over the intranet for our
TL;DR - Any webapp devs out there able to squeeze performance out of using
We are using sendmail to send mails from our web app and we do
I came across this control while using a webapp (this in invite-only beta) and
We need to be able to easily install our in-house apps on our devices
I'm trying to build our web application automatically. I need to be able to
Our web allows the user to publish tweets in his timeline automatically when he

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.