Hello , I am opening a report in SSRS on server, here is my code.. The problem that I have is , when try to open the report on click of a button.. It asks me enter network credentials, I hit cancel and I can see the report in excel but the credentail dialog
is irritating to the users..
On local m/c it does do that.. what I am I missing?
I tried the same kind of code to open the file in pdf and it doesn't ask for login credentials, only while opening in excel it does that.. any ideas please?
did you solve your issue? I have the exact same problem at the moment.
As far as i can tell Excel knows that the file came from a Webresource and tries to open it directly on the server via WebDAV and therefore asks for the credentials. If you click cancel it just opens the local version.
I had the ContentDispositionType of the Response configured as "Inline"
A body part should be marked with a DispositionType property of "inline" if it is intended to be displayed automatically upon display of the message. A body part can be designated with a DispositionType property
of "attachment" to indicate that they are separate from the main body of the HTTP request or response.
when i now click on open it acutally uses the file from the local Temp folder and doesn't try to open the file from the server -> so the prompt for the credentials doesn't appear any more...
hope this helps others!
Maybe also worth mentioning: this problem is not SSRS specific but can happen with every office document that is pushed inline into the HTTPResponse!
nissan
Participant
1065 Points
618 Posts
Access the SSRS Report in excel format on server
Feb 26, 2013 07:53 PM|LINK
Hello , I am opening a report in SSRS on server, here is my code.. The problem that I have is , when try to open the report on click of a button.. It asks me enter network credentials, I hit cancel and I can see the report in excel but the credentail dialog is irritating to the users..
On local m/c it does do that.. what I am I missing?
private void ShowReport() { rptQAQCReport.ShowCredentialPrompts = false; string url = ConfigurationReader.GetElementText("ReportUrl"); string path = ConfigurationReader.GetElementText("ReportPath"); rptQAQCReport.ServerReport.ReportServerUrl = new Uri(url); rptQAQCReport.ServerReport.ReportPath = path + "QAQCReview"; AttachCredentials(); List<ReportParameter> parameters = GetReportParameters(ddlMonth.SelectedItem.Value, ddlYear.SelectedItem.Value); if (parameters != null && parameters.Count > 0) { rptQAQCReport.ServerReport.SetParameters(parameters); } rptQAQCReport.ShowParameterPrompts = false; rptQAQCReport.ShowPromptAreaButton = false; rptQAQCReport.ServerReport.Refresh(); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; string deviceInfo = null; byte[] bytes = rptQAQCReport.ServerReport.Render( "Excel", deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); Response.ContentType = mimeType; Response.BinaryWrite(bytes); Response.Flush(); Response.End() ; }nissan
Participant
1065 Points
618 Posts
Re: Access the SSRS Report in excel format on server
Feb 26, 2013 09:15 PM|LINK
I tried the same kind of code to open the file in pdf and it doesn't ask for login credentials, only while opening in excel it does that.. any ideas please?
stockcer
Member
498 Points
128 Posts
Re: Access the SSRS Report in excel format on server
Feb 26, 2013 10:39 PM|LINK
try using web services like:
http://blog.arvixe.com/creating-pdf-or-any-other-file-type-from-sql-reporting-services-using-wsdl-vs2012-part-1/
ASP.NET Arvixe Liaison
James River Webs, Inc.
Abhi.ssrs
Member
180 Points
36 Posts
Re: Access the SSRS Report in excel format on server
Mar 04, 2013 04:09 AM|LINK
Hi, Please check if the option "pronpt for credentials " is selected in datsource properties -->Credential properties
for the mentioned report rdl. If checked you may uncheck that and redeploy and try.
stockcer
Member
498 Points
128 Posts
Re: Access the SSRS Report in excel format on server
Mar 21, 2013 07:14 PM|LINK
Please mark if any of the responses were helpful.
ASP.NET Arvixe Liaison
James River Webs, Inc.
pastrami01
Member
4 Points
2 Posts
Re: Access the SSRS Report in excel format on server
Apr 29, 2013 08:13 AM|LINK
Hello nissan,
did you solve your issue? I have the exact same problem at the moment.
As far as i can tell Excel knows that the file came from a Webresource and tries to open it directly on the server via WebDAV and therefore asks for the credentials. If you click cancel it just opens the local version.
Would be nice if you could share your solution.
pastrami01
Member
4 Points
2 Posts
Re: Access the SSRS Report in excel format on server
Apr 29, 2013 02:34 PM|LINK
So I figured it out ...
I had the ContentDispositionType of the Response configured as "Inline"
see: http://msdn.microsoft.com/en-us/library/system.net.http.headers.contentdispositionheadervalue.dispositiontype.aspx
when i changed it from:
Response.AddHeader("Content-Disposition", "inline; filename=ExcelReport.xls");to:
Response.AddHeader("Content-Disposition", "Attachment; filename=ExcelReport.xls");it still showed me the same prompt:
open / save / cancel
when i now click on open it acutally uses the file from the local Temp folder and doesn't try to open the file from the server -> so the prompt for the credentials doesn't appear any more...
hope this helps others!
Maybe also worth mentioning: this problem is not SSRS specific but can happen with every office document that is pushed inline into the HTTPResponse!