Friday, March 23, 2012
Prompting for userid and password
I have a web application which is calling a reporting services URL to load
couple of reports.
The web server is on Machine A and the reporting services and the SQL Server
are on Machine B.
Both the Machines A and B are not on any domain...
But when I log into my website and then try to generate a report, the web
application is popping up an prompt to enter the userid and password.
When U enter the userdid and password of the machine B, I am to view my
reports.
Can anyone please help me in resolving the above issue, where the user would
not want to enter the userid and password.Check the Reporting Services virtual directories in IIS. If they are not
setup with "Enable anonymous access", you need to enable this.
Kaisa M. Lindahl Lervik
"Ashok Segu" <Ashok Segu@.discussions.microsoft.com> wrote in message
news:99B66025-A1E6-49A1-8BFB-0E7B78A92189@.microsoft.com...
> Hi,
> I have a web application which is calling a reporting services URL to load
> couple of reports.
> The web server is on Machine A and the reporting services and the SQL
> Server
> are on Machine B.
> Both the Machines A and B are not on any domain...
> But when I log into my website and then try to generate a report, the web
> application is popping up an prompt to enter the userid and password.
> When U enter the userdid and password of the machine B, I am to view my
> reports.
> Can anyone please help me in resolving the above issue, where the user
> would
> not want to enter the userid and password.|||Add the url of the SSRS services to your "Trusted Sites" in Internet
Options. Surprisingly this works.
Ashok Segu wrote:
> Hi,
> I have a web application which is calling a reporting services URL to load
> couple of reports.
> The web server is on Machine A and the reporting services and the SQL Server
> are on Machine B.
> Both the Machines A and B are not on any domain...
> But when I log into my website and then try to generate a report, the web
> application is popping up an prompt to enter the userid and password.
> When U enter the userdid and password of the machine B, I am to view my
> reports.
> Can anyone please help me in resolving the above issue, where the user would
> not want to enter the userid and password.
Monday, March 12, 2012
Programmatically Render Report to PDF
Hello,
I'm looking for an example on how to programmatically render a report to pdf in C#. I don't want to use a url with the rs:Format=pdf querystring. Any help would be much appreciated!!
Hello,
Have a look at this doc page:
http://msdn2.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswebservice.rsexecutionservice2005.reportexecutionservice.render.aspx
There is a full example of how to render reports programmatically using the Render method.
-Chris
|||Hi Chris,
Thanks for your response. I took a look at the link you gave me and now I'm getting the following error:
There was an error opening this document. The file is damaged and cannot be repaired.
Here is the code I'm using:
localhost.ReportingService rs = new localhost.ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
byte[] ResultStream;
string[] StreamIdentifiers;
string OptionalParam = null;
string deviceInfo = "<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.5in</MarginTop>" +
" <MarginLeft>0.5in</MarginLeft>" +
" <MarginRight>0.5in</MarginRight>" +
" <MarginBottom>0.5in</MarginBottom>" +
"</DeviceInfo>";
string mimetype;
string encoding;
string historyid = null;
localhost.ParameterValue[] optionalParams = new localhost.ParameterValue[1];
optionalParams[0] = new localhost.ParameterValue();
optionalParams[0].Name = "applicantid";
optionalParams[0].Value = "10";
localhost.Warning[] optionalWarnings = null;
ResultStream = rs.Render("/employmentapplication/printableemploymentapplication",
"pdf",
historyid,
deviceInfo,
optionalParams,
null,
null,
out encoding,
out mimetype,
out optionalParams,
out optionalWarnings,
out StreamIdentifiers);
Response.BinaryWrite(ResultStream);
No matter which report I try to open, I get the same error. Any help is greatly appreciated!!!
Thanks!!
Daniel
|||You get that error when you attempt to open the document?
It could be that there is some extraneous stuff being written to the HTTP stream to which you do your BinaryWrite. I suggest writing "ResultStream" to a file to isolate where corruption, if any, may be occurring.
Also, the OutputFormat value in DeviceInfo is not necessary when rendering to PDF since you're specifying the render format in the Render method call.
-Chris
|||There shouldn't be any extra bytes in the response stream so you shouldn't worry about that. Make sure that you are actually closing the BinaryWriter. Many of the CLR streams buffer internally, so if they are not closed completely then there can be problems where all of the data is not being written.|||
Hi John -
Thanks for you response. How do I close Response.BinaryWriter? Do you have an example of programmatically rendering a report to pdf that I can look at? Thanks again for all your help!!!
|||From the RS side of the things, you are doing things correctly. As Chris pointed out, I would look into making sure that you are properly handling the Response stream. If you are writing any other data to it, then you will run into problems.
You should be able to call .Flush() on the stream to make sure the contents are completely written out.
-John
|||I was running into the same issue today... calling Flush() and Close() on the response object fixed my issues.
--Andy
|||Hello,
I have successfully implemented the sample referenced above with a VB.NET console app. I would like to build a CLR stored procedure that implements the same code, programmatically generating a PDF report and outputting it to a file. I'm running into permissions issues.
Anybody had any luck calling the Reporting Services Web Service API from inside a CLR stored procedure?
Ken
|||Renskemo, you might want to take this question over to the following forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=86&SiteID=1
Programmatically Render Report to PDF
Hello,
I'm looking for an example on how to programmatically render a report to pdf in C#. I don't want to use a url with the rs:Format=pdf querystring. Any help would be much appreciated!!
Hello,
Have a look at this doc page:
http://msdn2.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswebservice.rsexecutionservice2005.reportexecutionservice.render.aspx
There is a full example of how to render reports programmatically using the Render method.
-Chris
|||Hi Chris,
Thanks for your response. I took a look at the link you gave me and now I'm getting the following error:
There was an error opening this document. The file is damaged and cannot be repaired.
Here is the code I'm using:
localhost.ReportingService rs = new localhost.ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
byte[] ResultStream;
string[] StreamIdentifiers;
string OptionalParam = null;
string deviceInfo = "<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.5in</MarginTop>" +
" <MarginLeft>0.5in</MarginLeft>" +
" <MarginRight>0.5in</MarginRight>" +
" <MarginBottom>0.5in</MarginBottom>" +
"</DeviceInfo>";
string mimetype;
string encoding;
string historyid = null;
localhost.ParameterValue[] optionalParams = new localhost.ParameterValue[1];
optionalParams[0] = new localhost.ParameterValue();
optionalParams[0].Name = "applicantid";
optionalParams[0].Value = "10";
localhost.Warning[] optionalWarnings = null;
ResultStream = rs.Render("/employmentapplication/printableemploymentapplication",
"pdf",
historyid,
deviceInfo,
optionalParams,
null,
null,
out encoding,
out mimetype,
out optionalParams,
out optionalWarnings,
out StreamIdentifiers);
Response.BinaryWrite(ResultStream);
No matter which report I try to open, I get the same error. Any help is greatly appreciated!!!
Thanks!!
Daniel
|||You get that error when you attempt to open the document?
It could be that there is some extraneous stuff being written to the HTTP stream to which you do your BinaryWrite. I suggest writing "ResultStream" to a file to isolate where corruption, if any, may be occurring.
Also, the OutputFormat value in DeviceInfo is not necessary when rendering to PDF since you're specifying the render format in the Render method call.
-Chris
|||There shouldn't be any extra bytes in the response stream so you shouldn't worry about that. Make sure that you are actually closing the BinaryWriter. Many of the CLR streams buffer internally, so if they are not closed completely then there can be problems where all of the data is not being written.|||
Hi John -
Thanks for you response. How do I close Response.BinaryWriter? Do you have an example of programmatically rendering a report to pdf that I can look at? Thanks again for all your help!!!
|||From the RS side of the things, you are doing things correctly. As Chris pointed out, I would look into making sure that you are properly handling the Response stream. If you are writing any other data to it, then you will run into problems.
You should be able to call .Flush() on the stream to make sure the contents are completely written out.
-John
|||I was running into the same issue today... calling Flush() and Close() on the response object fixed my issues.
--Andy
|||Hello,
I have successfully implemented the sample referenced above with a VB.NET console app. I would like to build a CLR stored procedure that implements the same code, programmatically generating a PDF report and outputting it to a file. I'm running into permissions issues.
Anybody had any luck calling the Reporting Services Web Service API from inside a CLR stored procedure?
Ken
|||Renskemo, you might want to take this question over to the following forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=86&SiteID=1