Hi Vinay,
You can extract the report like the following.
string strReportUser = "RSUserName";
string strReportUserPW = "MySecretPassword";
string strReportUserDomain = "DomainName";
string sTargetURL = "http://SqlServer/ReportServer?" +
"/MyReportFolder/Report1&rs:Command=Render&rs:format=PDF&ReportParam=" +
ParamValue;
HttpWebRequest req =
(HttpWebRequest)WebRequest.Create( sTargetURL );
req.PreAuthenticate = true;
req.Credentials = new System.Net.NetworkCredential(
strReportUser,
strReportUserPW,
strReportUserDomain );
HttpWebResponse HttpWResp = (HttpWebResponse)req.GetResponse();
Stream fStream = HttpWResp.GetResponseStream();
HttpWResp.Close();
byte[] fileBytes = ReadFully( fStream );
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader(
"content-disposition",
"attachment; filename=\"Report For " +
ParamValue + ".pdf\"" );
Response.BinaryWrite( fileBytes );
Response.Flush();
Response.End();
ReadFully is
public static byte[] ReadFully( Stream input )
{
using ( MemoryStream ms = new MemoryStream() )
{
input.CopyTo( ms );
return ms.ToArray();
}
}
You can refer the following link too.
Render report to PDF format
Thanks