Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

Access Denied When Rendering a Report Using System.Net.CredentailCache.DefaultCredentials

When I render a report on my local mahcine using the following code - it works correctly and the report is rendered - but with the same code - I'm getting an "401 - Access Denied" on another machine.  What would affet the "System.Net.CredentialCache.DefaultCredentials" so that it worked correctly in one instance but not in another?  

ReportingServices2005.ServerReportOutput output =  new .ReportingServices2005.ServerReportOutput();
 
string reporttype = Request.QueryString["Document"];
string reportname = "ReportName";
       
 output.ReportParameters.Add("ReviewID",Request.QueryString["ReviewID"]);
 output.ReportExecutionUrl = System.Configuration.ConfigurationManager.AppSettings["ReportServer"];
       
output.ReportExecutionCredentials = System.Net.CredentialCache.DefaultCredentials;
output.ReportPath = reportname;
output.OutputType = InfinityIncremented.ReportingServices2005.OutputType.AdobePDF;

thanks in advance for any help with this.
0
coecho
Asked:
coecho
2 Solutions
 
AgariciCommented:
usually you this error when accessing (from your code, with the specified credentials) some file or path which is not accessible to the web server user.
you should try to use only files/paths that are under your application's folder and ensure the folders have the correct credentials set.

you can try using other credentials (some user that you know has access), just to validate the problem.

hth,
A.
0
 
coechoAuthor Commented:
Acutally, it turned out that becuase I had my Web app on a different server, the credentials are not automaticfally being passed to the web server.  By explicitly setting the credentials, I was able to get this working.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now