Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

401 Unauthorized error while accessing SSRS snapshot from C# code

$
0
0

Hi,

We have our application(c#, .net 3.5Sp1) and SSRS 2008 running on one box (windows server 2008 R2) and SQL Server 2008 running on another box.

The C# app code is calling the below url.

http://<hostname>/reportserver?/AppFolderOnSSRS/Snapshots/My Report/08b79d50-9288-47c8-9c46-ff6d83367bda&rs:Snapshot=2013-04-03T11:45:43&rs:SessionID=phjeo1r0jkvreh3zs5acls45&rs:Format=HTML4.0&rc:Toolbar=false

Here is the app code which do this

StringBuilder sb =newStringBuilder(urlAccessUri.GetLeftPart(UriPartial.Path)+"?"+ snapshotConfiguration.linkedReportPath +"&rs:Snapshot="+ snapshotConfiguration.historyId +"&rs:SessionID="+ ctx.SessionId);

HttpWebRequest request =(HttpWebRequest)WebRequest.Create(sb.ToString());
request
.Method="GET";
request
.KeepAlive=false;
request
.Timeout=HttpRequestTimeout;
request
.UseDefaultCredentials=true;
request
.PreAuthenticate=true;

HttpWebResponse response =(HttpWebResponse) request.GetResponse()


In the Reporting Service I have created a role (MyRole) and have assigned 

1.Create Linked Reports
2.View Reports
3.Manage Reports
4.View Resources
5.View Folders
6.Manage Folders
7.Manage Report History
8.View Data Sources
9.View Models
10.Consume Reports

Then I have assigned "MyRole" for AppFolderOnSSRS (in SSRS) to the account under which my C# app is running.

The last line in the above code snippet "HttpWebResponse response = (HttpWebResponse) request.GetResponse()" throws the "The remote server returned an error: (401) Unauthorized" error.

Regards,
Saif


Viewing all articles
Browse latest Browse all 27852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>