Monday, February 20, 2012

Rendering Reports to Web Application

I have Web application and I am trying to integrate Reports from SQL
Reporting Service in it.
I can render a report to a page from my application. The problem is the if a
report has links to other reports then those links send you strait to Report
Service site and not back to my application.
Is there a way out of this?
Thanks,
ShimonShimon,
I assume that your application:
1. Renders reports by SOAP on the server side of the application.
2. By report links to the Report Service site you mean reports are requested
by URL but you want them to redirect to your application.
If the above is correct, can you replace those links with your page URL?
--
Hope this helps.
---
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---
"Shimon Sim" <estshim@.att.net> wrote in message
news:uuxWcSssEHA.904@.TK2MSFTNGP11.phx.gbl...
> I have Web application and I am trying to integrate Reports from SQL
> Reporting Service in it.
> I can render a report to a page from my application. The problem is the if
a
> report has links to other reports then those links send you strait to
Report
> Service site and not back to my application.
> Is there a way out of this?
> Thanks,
> Shimon
>|||I am using ASP.NET and I was trying to figure out if I can use RS for our
project. I have form based security access for my ASP.NET application.
Besides that we have role based application check that is custom
implemented. Window based security of RS is a big issue and I am trying to
get around it.
I saw the article that you sent me to about ASPNET account. Some how it just
doesn't work on my machine.
If pass account of local administrator with name and password it does work
on my machine.
The issue with link is following
I report doesn't have drill down, drill through or charts - anything that
requires links for working works fine. But if I have chart - picture is
missing, if I have drill done + then I am sent to regular site
MYSERVER/Reports... and of cause if user doesn't have proper windows account
he is denied. The same thing with drill through - links to other reports-
they send me to wrong page.
I don't know how to replace link.
This is the code that I am using:
private void Page_Load(object sender, System.EventArgs e)
{
string path=Request.Params["Path"];
string format=Request.Params["Format"];
// Create service
ReportingService rs=new WebReports.ReportingService.ReportingService();
System.Net.NetworkCredential nwc=new
System.Net.NetworkCredential("MyName","pass","server");
rs.Credentials=nwc;
ParameterValue[] parameters=new ParameterValue[0];
string encoding;
string mimeType;
ParameterValue[] parametersUsed;
Warning[] warnings;
string[] streamIds;
//render the report
byte[] data;
data=rs.Render(path,format, null,null,parameters,null,null,
out encoding, out mimeType, out parametersUsed, out warnings, out
streamIds);
string extension=this.GetExtension(mimeType); //this is just a private
function to get
//an extension for the mimeType
string reportName=path.Substring(path.LastIndexOf("/")+1);
string fileName=reportName+"."+extension;
//write report back to response object
Response.Clear();
Response.ContentType=mimeType;
//add the file name to the response if it is not a web browser format
if(mimeType!="text/html")
Response.AddHeader("Content-Disposition","attachment;filename=" + fileName);
Response.BinaryWrite(data);
}
(I got it from a book)
I don't see any way to control links.
Can you help?
Shimon.
"Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com> wrote in message
news:O3mwG1xsEHA.3972@.TK2MSFTNGP15.phx.gbl...
> Shimon,
> I assume that your application:
> 1. Renders reports by SOAP on the server side of the application.
> 2. By report links to the Report Service site you mean reports are
> requested
> by URL but you want them to redirect to your application.
> If the above is correct, can you replace those links with your page URL?
> --
> Hope this helps.
> ---
> Teo Lachev, MVP [SQL Server], MCSD, MCT
> Author: "Microsoft Reporting Services in Action"
> Publisher website: http://www.manning.com/lachev
> Buy it from Amazon.com: http://shrinkster.com/eq
> Home page and blog: http://www.prologika.com/
> ---
> "Shimon Sim" <estshim@.att.net> wrote in message
> news:uuxWcSssEHA.904@.TK2MSFTNGP11.phx.gbl...
>> I have Web application and I am trying to integrate Reports from SQL
>> Reporting Service in it.
>> I can render a report to a page from my application. The problem is the
>> if
> a
>> report has links to other reports then those links send you strait to
> Report
>> Service site and not back to my application.
>> Is there a way out of this?
>> Thanks,
>> Shimon
>>
>|||This happens because the report interactive features require direct access
to the Report Server by URL and there is no way around it. Basically, you
have two approaches:
1. Render the reports on the server side of the application by calling the
Render SOAP API.
- Pros: better security since the report URL cannot be intercepted by
the end user.
- Cons: the reports CANNOT have interactive features since they rely on
URL addressability, you have to take extra steps to handle report images and
the presenting the report to the end user. If you take the SOAP approach,
you may find the enchanced version of the ReportViewer control ( can be
downloaded from the publisher website) useful.
2. Replace the Windows-based security with custom security.
- Pros: you can authenticate and authorize the users any way you want
including integrating RS with your web application.
- Cons: Development effort required.
--
Hope this helps.
---
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---
"Shimon Sim" <estshim@.att.net> wrote in message
news:eARiBe%23sEHA.3324@.TK2MSFTNGP15.phx.gbl...
> I am using ASP.NET and I was trying to figure out if I can use RS for our
> project. I have form based security access for my ASP.NET application.
> Besides that we have role based application check that is custom
> implemented. Window based security of RS is a big issue and I am trying to
> get around it.
> I saw the article that you sent me to about ASPNET account. Some how it
just
> doesn't work on my machine.
> If pass account of local administrator with name and password it does
work
> on my machine.
> The issue with link is following
> I report doesn't have drill down, drill through or charts - anything that
> requires links for working works fine. But if I have chart - picture is
> missing, if I have drill done + then I am sent to regular site
> MYSERVER/Reports... and of cause if user doesn't have proper windows
account
> he is denied. The same thing with drill through - links to other reports-
> they send me to wrong page.
> I don't know how to replace link.
> This is the code that I am using:
> private void Page_Load(object sender, System.EventArgs e)
> {
> string path=Request.Params["Path"];
> string format=Request.Params["Format"];
> // Create service
> ReportingService rs=new WebReports.ReportingService.ReportingService();
> System.Net.NetworkCredential nwc=new
> System.Net.NetworkCredential("MyName","pass","server");
> rs.Credentials=nwc;
> ParameterValue[] parameters=new ParameterValue[0];
> string encoding;
> string mimeType;
> ParameterValue[] parametersUsed;
> Warning[] warnings;
> string[] streamIds;
> //render the report
> byte[] data;
> data=rs.Render(path,format, null,null,parameters,null,null,
> out encoding, out mimeType, out parametersUsed, out warnings, out
> streamIds);
> string extension=this.GetExtension(mimeType); //this is just a private
> function to get
> //an extension for the mimeType
> string reportName=path.Substring(path.LastIndexOf("/")+1);
> string fileName=reportName+"."+extension;
> //write report back to response object
> Response.Clear();
> Response.ContentType=mimeType;
> //add the file name to the response if it is not a web browser format
> if(mimeType!="text/html")
> Response.AddHeader("Content-Disposition","attachment;filename=" +
fileName);
> Response.BinaryWrite(data);
> }
> (I got it from a book)
> I don't see any way to control links.
> Can you help?
> Shimon.
>
> "Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com> wrote in message
> news:O3mwG1xsEHA.3972@.TK2MSFTNGP15.phx.gbl...
> > Shimon,
> >
> > I assume that your application:
> > 1. Renders reports by SOAP on the server side of the application.
> > 2. By report links to the Report Service site you mean reports are
> > requested
> > by URL but you want them to redirect to your application.
> >
> > If the above is correct, can you replace those links with your page URL?
> >
> > --
> > Hope this helps.
> >
> > ---
> > Teo Lachev, MVP [SQL Server], MCSD, MCT
> > Author: "Microsoft Reporting Services in Action"
> > Publisher website: http://www.manning.com/lachev
> > Buy it from Amazon.com: http://shrinkster.com/eq
> > Home page and blog: http://www.prologika.com/
> > ---
> >
> > "Shimon Sim" <estshim@.att.net> wrote in message
> > news:uuxWcSssEHA.904@.TK2MSFTNGP11.phx.gbl...
> >> I have Web application and I am trying to integrate Reports from SQL
> >> Reporting Service in it.
> >> I can render a report to a page from my application. The problem is the
> >> if
> > a
> >> report has links to other reports then those links send you strait to
> > Report
> >> Service site and not back to my application.
> >>
> >> Is there a way out of this?
> >>
> >> Thanks,
> >> Shimon
> >>
> >>
> >
> >
>|||Thank you for the answer. I will go through all the approaches before making
final decision.
Just how do I replace Windows security.Can I work with it as any ASP.NET
application - changing config file and publishing my pages? Can I use code
behind files?
Thanks,
Shimon.
"Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com> wrote in message
news:uCm08WJtEHA.2808@.TK2MSFTNGP14.phx.gbl...
> This happens because the report interactive features require direct access
> to the Report Server by URL and there is no way around it. Basically, you
> have two approaches:
> 1. Render the reports on the server side of the application by calling the
> Render SOAP API.
> - Pros: better security since the report URL cannot be intercepted by
> the end user.
> - Cons: the reports CANNOT have interactive features since they rely on
> URL addressability, you have to take extra steps to handle report images
> and
> the presenting the report to the end user. If you take the SOAP approach,
> you may find the enchanced version of the ReportViewer control ( can be
> downloaded from the publisher website) useful.
> 2. Replace the Windows-based security with custom security.
> - Pros: you can authenticate and authorize the users any way you want
> including integrating RS with your web application.
> - Cons: Development effort required.
> --
> Hope this helps.
> ---
> Teo Lachev, MVP [SQL Server], MCSD, MCT
> Author: "Microsoft Reporting Services in Action"
> Publisher website: http://www.manning.com/lachev
> Buy it from Amazon.com: http://shrinkster.com/eq
> Home page and blog: http://www.prologika.com/
> ---
> "Shimon Sim" <estshim@.att.net> wrote in message
> news:eARiBe%23sEHA.3324@.TK2MSFTNGP15.phx.gbl...
>> I am using ASP.NET and I was trying to figure out if I can use RS for our
>> project. I have form based security access for my ASP.NET application.
>> Besides that we have role based application check that is custom
>> implemented. Window based security of RS is a big issue and I am trying
>> to
>> get around it.
>> I saw the article that you sent me to about ASPNET account. Some how it
> just
>> doesn't work on my machine.
>> If pass account of local administrator with name and password it does
> work
>> on my machine.
>> The issue with link is following
>> I report doesn't have drill down, drill through or charts - anything that
>> requires links for working works fine. But if I have chart - picture is
>> missing, if I have drill done + then I am sent to regular site
>> MYSERVER/Reports... and of cause if user doesn't have proper windows
> account
>> he is denied. The same thing with drill through - links to other reports-
>> they send me to wrong page.
>> I don't know how to replace link.
>> This is the code that I am using:
>> private void Page_Load(object sender, System.EventArgs e)
>> {
>> string path=Request.Params["Path"];
>> string format=Request.Params["Format"];
>> // Create service
>> ReportingService rs=new WebReports.ReportingService.ReportingService();
>> System.Net.NetworkCredential nwc=new
>> System.Net.NetworkCredential("MyName","pass","server");
>> rs.Credentials=nwc;
>> ParameterValue[] parameters=new ParameterValue[0];
>> string encoding;
>> string mimeType;
>> ParameterValue[] parametersUsed;
>> Warning[] warnings;
>> string[] streamIds;
>> //render the report
>> byte[] data;
>> data=rs.Render(path,format, null,null,parameters,null,null,
>> out encoding, out mimeType, out parametersUsed, out warnings, out
>> streamIds);
>> string extension=this.GetExtension(mimeType); //this is just a private
>> function to get
>> //an extension for the mimeType
>> string reportName=path.Substring(path.LastIndexOf("/")+1);
>> string fileName=reportName+"."+extension;
>> //write report back to response object
>> Response.Clear();
>> Response.ContentType=mimeType;
>> //add the file name to the response if it is not a web browser format
>> if(mimeType!="text/html")
>> Response.AddHeader("Content-Disposition","attachment;filename=" +
> fileName);
>> Response.BinaryWrite(data);
>> }
>> (I got it from a book)
>> I don't see any way to control links.
>> Can you help?
>> Shimon.
>>
>> "Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com> wrote in message
>> news:O3mwG1xsEHA.3972@.TK2MSFTNGP15.phx.gbl...
>> > Shimon,
>> >
>> > I assume that your application:
>> > 1. Renders reports by SOAP on the server side of the application.
>> > 2. By report links to the Report Service site you mean reports are
>> > requested
>> > by URL but you want them to redirect to your application.
>> >
>> > If the above is correct, can you replace those links with your page
>> > URL?
>> >
>> > --
>> > Hope this helps.
>> >
>> > ---
>> > Teo Lachev, MVP [SQL Server], MCSD, MCT
>> > Author: "Microsoft Reporting Services in Action"
>> > Publisher website: http://www.manning.com/lachev
>> > Buy it from Amazon.com: http://shrinkster.com/eq
>> > Home page and blog: http://www.prologika.com/
>> > ---
>> >
>> > "Shimon Sim" <estshim@.att.net> wrote in message
>> > news:uuxWcSssEHA.904@.TK2MSFTNGP11.phx.gbl...
>> >> I have Web application and I am trying to integrate Reports from SQL
>> >> Reporting Service in it.
>> >> I can render a report to a page from my application. The problem is
>> >> the
>> >> if
>> > a
>> >> report has links to other reports then those links send you strait to
>> > Report
>> >> Service site and not back to my application.
>> >>
>> >> Is there a way out of this?
>> >>
>> >> Thanks,
>> >> Shimon
>> >>
>> >>
>> >
>> >
>>
>|||Shimon,
A good place to start with RS custom security is the Forms Authentication
white paper by Microsoft
(http://msdn.microsoft.com/library/?url=/library/en-us/dnsql2k/html/ufairs.a
sp?frame=true#ufairs_topic3).
Custom security (a.k.a Forms Authentication) has been discussed in this
forum on many occasions. So, please be sure to check the forum to understand
the pros and cons before you decide whether you want to go for it.
--
Hope this helps.
---
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---
"Shimon Sim" <estshim@.att.net> wrote in message
news:uPURWOKtEHA.2560@.tk2msftngp13.phx.gbl...
> Thank you for the answer. I will go through all the approaches before
making
> final decision.
> Just how do I replace Windows security.Can I work with it as any ASP.NET
> application - changing config file and publishing my pages? Can I use code
> behind files?
> Thanks,
> Shimon.
> "Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com> wrote in message
> news:uCm08WJtEHA.2808@.TK2MSFTNGP14.phx.gbl...
> > This happens because the report interactive features require direct
access
> > to the Report Server by URL and there is no way around it. Basically,
you
> > have two approaches:
> >
> > 1. Render the reports on the server side of the application by calling
the
> > Render SOAP API.
> > - Pros: better security since the report URL cannot be intercepted by
> > the end user.
> > - Cons: the reports CANNOT have interactive features since they rely
on
> > URL addressability, you have to take extra steps to handle report images
> > and
> > the presenting the report to the end user. If you take the SOAP
approach,
> > you may find the enchanced version of the ReportViewer control ( can be
> > downloaded from the publisher website) useful.
> >
> > 2. Replace the Windows-based security with custom security.
> > - Pros: you can authenticate and authorize the users any way you want
> > including integrating RS with your web application.
> > - Cons: Development effort required.
> >
> > --
> > Hope this helps.
> >
> > ---
> > Teo Lachev, MVP [SQL Server], MCSD, MCT
> > Author: "Microsoft Reporting Services in Action"
> > Publisher website: http://www.manning.com/lachev
> > Buy it from Amazon.com: http://shrinkster.com/eq
> > Home page and blog: http://www.prologika.com/
> > ---
> >
> > "Shimon Sim" <estshim@.att.net> wrote in message
> > news:eARiBe%23sEHA.3324@.TK2MSFTNGP15.phx.gbl...
> >> I am using ASP.NET and I was trying to figure out if I can use RS for
our
> >> project. I have form based security access for my ASP.NET application.
> >> Besides that we have role based application check that is custom
> >> implemented. Window based security of RS is a big issue and I am trying
> >> to
> >> get around it.
> >>
> >> I saw the article that you sent me to about ASPNET account. Some how it
> > just
> >> doesn't work on my machine.
> >> If pass account of local administrator with name and password it does
> > work
> >> on my machine.
> >> The issue with link is following
> >> I report doesn't have drill down, drill through or charts - anything
that
> >> requires links for working works fine. But if I have chart - picture is
> >> missing, if I have drill done + then I am sent to regular site
> >> MYSERVER/Reports... and of cause if user doesn't have proper windows
> > account
> >> he is denied. The same thing with drill through - links to other
reports-
> >> they send me to wrong page.
> >>
> >> I don't know how to replace link.
> >>
> >> This is the code that I am using:
> >>
> >> private void Page_Load(object sender, System.EventArgs e)
> >>
> >> {
> >>
> >> string path=Request.Params["Path"];
> >>
> >> string format=Request.Params["Format"];
> >>
> >> // Create service
> >>
> >> ReportingService rs=new WebReports.ReportingService.ReportingService();
> >>
> >> System.Net.NetworkCredential nwc=new
> >> System.Net.NetworkCredential("MyName","pass","server");
> >>
> >> rs.Credentials=nwc;
> >>
> >> ParameterValue[] parameters=new ParameterValue[0];
> >>
> >> string encoding;
> >>
> >> string mimeType;
> >>
> >> ParameterValue[] parametersUsed;
> >>
> >> Warning[] warnings;
> >>
> >> string[] streamIds;
> >>
> >> //render the report
> >>
> >> byte[] data;
> >>
> >> data=rs.Render(path,format, null,null,parameters,null,null,
> >>
> >> out encoding, out mimeType, out parametersUsed, out warnings, out
> >> streamIds);
> >>
> >> string extension=this.GetExtension(mimeType); //this is just a private
> >> function to get
> >>
> >> //an extension for the mimeType
> >>
> >> string reportName=path.Substring(path.LastIndexOf("/")+1);
> >>
> >> string fileName=reportName+"."+extension;
> >>
> >> //write report back to response object
> >>
> >> Response.Clear();
> >>
> >> Response.ContentType=mimeType;
> >>
> >> //add the file name to the response if it is not a web browser format
> >>
> >> if(mimeType!="text/html")
> >>
> >> Response.AddHeader("Content-Disposition","attachment;filename=" +
> > fileName);
> >>
> >> Response.BinaryWrite(data);
> >>
> >> }
> >>
> >> (I got it from a book)
> >> I don't see any way to control links.
> >>
> >> Can you help?
> >> Shimon.
> >>
> >>
> >>
> >> "Teo Lachev [MVP]" <teo.lachev@.nospam.prologika.com> wrote in message
> >> news:O3mwG1xsEHA.3972@.TK2MSFTNGP15.phx.gbl...
> >> > Shimon,
> >> >
> >> > I assume that your application:
> >> > 1. Renders reports by SOAP on the server side of the application.
> >> > 2. By report links to the Report Service site you mean reports are
> >> > requested
> >> > by URL but you want them to redirect to your application.
> >> >
> >> > If the above is correct, can you replace those links with your page
> >> > URL?
> >> >
> >> > --
> >> > Hope this helps.
> >> >
> >> > ---
> >> > Teo Lachev, MVP [SQL Server], MCSD, MCT
> >> > Author: "Microsoft Reporting Services in Action"
> >> > Publisher website: http://www.manning.com/lachev
> >> > Buy it from Amazon.com: http://shrinkster.com/eq
> >> > Home page and blog: http://www.prologika.com/
> >> > ---
> >> >
> >> > "Shimon Sim" <estshim@.att.net> wrote in message
> >> > news:uuxWcSssEHA.904@.TK2MSFTNGP11.phx.gbl...
> >> >> I have Web application and I am trying to integrate Reports from SQL
> >> >> Reporting Service in it.
> >> >> I can render a report to a page from my application. The problem is
> >> >> the
> >> >> if
> >> > a
> >> >> report has links to other reports then those links send you strait
to
> >> > Report
> >> >> Service site and not back to my application.
> >> >>
> >> >> Is there a way out of this?
> >> >>
> >> >> Thanks,
> >> >> Shimon
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>

No comments:

Post a Comment